You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Adds `--env` and `--env-file` flags that can be used with `run` `shell`
and `services`
If both flags are specified they are merged with `--env` taking
precedence.
environment variables passed in with flags take the highest level of
precedence, replacing any env variables set by nix, devbox.json, or
plugins.
TODO: The flag code is a bit brittle and repetitive, I think we can
consolidate the common flag registration.
## How was it tested?
```
devbox run -e FOO=BAR echo \$FOO
devbox services up -e HTTPD_PORT=8083
```
Copy file name to clipboardExpand all lines: internal/boxcli/run.go
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ import (
20
20
)
21
21
22
22
typerunCmdFlagsstruct {
23
+
envFlag
23
24
configconfigFlags
24
25
purebool
25
26
listScriptsbool
@@ -43,6 +44,7 @@ func runCmd() *cobra.Command {
43
44
},
44
45
}
45
46
47
+
flags.envFlag.register(command)
46
48
flags.config.register(command)
47
49
command.Flags().BoolVar(
48
50
&flags.pure, "pure", false, "If this flag is specified, devbox runs the script in an isolated environment inheriting almost no variables from the current environment. A few variables, in particular HOME, USER and DISPLAY, are retained.")
&flags.pure, "pure", false, "If this flag is specified, devbox creates an isolated shell inheriting almost no variables from the current environment. A few variables, in particular HOME, USER and DISPLAY, are retained.")
&flags.pure, "pure", false, "If this flag is specified, devbox creates an isolated environment inheriting almost no variables from the current environment. A few variables, in particular HOME, USER and DISPLAY, are retained.")
0 commit comments