Skip to content

Commit

Permalink
feat(config): allow cli to be run in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjayjpg committed May 11, 2022
1 parent 00072eb commit 924fb7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/meroxa/global/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func GetMeroxaAuthDomain() string {
func GetMeroxaAuthClientID() string {
return getEnvVal([]string{"MEROXA_AUTH_CLIENT_ID", "MEROXA_CLIENT_ID"}, "2VC9z0ZxtzTcQLDNygeEELV3lYFRZwpb")
}
func GetDevModeSetting() string {
return getEnvVal([]string{"MEROXA_CLI_DEV_MODE", "DEV_MODE"}, "false")
}

// getEnvVal returns the value of either the first existing key specified in keys, or defaultVal if none were present.
func getEnvVal(keys []string, defaultVal string) string {
Expand Down
8 changes: 7 additions & 1 deletion cmd/meroxa/turbine_cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"regexp"
"strings"

"github.com/meroxa/cli/cmd/meroxa/global"
"github.com/meroxa/cli/log"
)

Expand Down Expand Up @@ -405,7 +406,12 @@ func CreateTarAndZipFile(src string, buf io.Writer) error {
}

func RunTurbineJS(params ...string) (cmd *exec.Cmd) {
turbineJSArgs := []string{"npx", "--yes", "@meroxa/[email protected]"}
isDevModeActive := global.GetDevModeSetting()
turbineJSBinary := "@meroxa/[email protected]"
if isDevModeActive == "true" {
turbineJSBinary = "turbine"
}
turbineJSArgs := []string{"npx", "--yes", turbineJSBinary}
args := append(turbineJSArgs, params...)
return exec.Command(args[0], args[1:]...)
}

0 comments on commit 924fb7f

Please sign in to comment.