forked from toolshed/abra
feat(cmd): make env variables accessible for local abra.sh commands
This commit is contained in:
parent
f6f587e506
commit
9591e91ed6
@ -74,13 +74,17 @@ Example:
|
|||||||
|
|
||||||
logrus.Debugf("--local detected, running %s on local work station", cmdName)
|
logrus.Debugf("--local detected, running %s on local work station", cmdName)
|
||||||
|
|
||||||
|
var exportEnv string
|
||||||
|
for k, v := range app.Env {
|
||||||
|
exportEnv = exportEnv + fmt.Sprintf("%s='%s'; ", k, v)
|
||||||
|
}
|
||||||
var sourceAndExec string
|
var sourceAndExec string
|
||||||
if hasCmdArgs {
|
if hasCmdArgs {
|
||||||
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
||||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s %s", app.Name, app.StackName(), abraSh, cmdName, parsedCmdArgs)
|
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; %s . %s; %s %s", app.Name, app.StackName(), exportEnv, abraSh, cmdName, parsedCmdArgs)
|
||||||
} else {
|
} else {
|
||||||
logrus.Debug("did not detect any command arguments")
|
logrus.Debug("did not detect any command arguments")
|
||||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s", app.Name, app.StackName(), abraSh, cmdName)
|
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; %s . %s; %s", app.Name, app.StackName(), exportEnv, abraSh, cmdName)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("/bin/sh", "-c", sourceAndExec)
|
cmd := exec.Command("/bin/sh", "-c", sourceAndExec)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user