diff --git a/src/cmd/run.go b/src/cmd/run.go index 746ec1e..0a83709 100644 --- a/src/cmd/run.go +++ b/src/cmd/run.go @@ -59,11 +59,15 @@ var runCmd = &cobra.Command{ // ensure vars are uppercase setRunnerVariables = helpers.TransformMapKeys(setRunnerVariables, strings.ToUpper) - // set any env vars that come from the environment + // set any env vars that come from the environment (taking MARU_ over VENDOR_) for _, variable := range tasksFile.Variables { if _, ok := setRunnerVariables[variable.Name]; !ok { if value := os.Getenv(fmt.Sprintf("%s_%s", strings.ToUpper(config.EnvPrefix), variable.Name)); value != "" { setRunnerVariables[variable.Name] = value + } else if config.VendorPrefix != "" { + if value := os.Getenv(fmt.Sprintf("%s_%s", strings.ToUpper(config.VendorPrefix), variable.Name)); value != "" { + setRunnerVariables[variable.Name] = value + } } } } diff --git a/src/config/config.go b/src/config/config.go index 56e2000..0a4a366 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -33,6 +33,9 @@ var ( // TempDirectory is the directory to store temporary files TempDirectory string + // VendorPrefix is the prefix for environment variables that an application vendoring Maru wants to use + VendorPrefix string + extraEnv = map[string]string{"MARU": "true", "MARU_ARCH": GetArch()} )