aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-06 09:36:08 -0400
committerGitHub <noreply@github.com>2020-07-06 09:36:08 -0400
commit4bdc11951e152459138e1562c0f9ef72af37feee (patch)
tree06160dcc2be5578be914dcc394db632adea12b4b /cmd
parent262843e1ce22575483f66fcd17a237202eaa3108 (diff)
parent4192298be3e55207ca983c21f357029df9765c56 (diff)
downloadpodman-4bdc11951e152459138e1562c0f9ef72af37feee.tar.gz
podman-4bdc11951e152459138e1562c0f9ef72af37feee.tar.bz2
podman-4bdc11951e152459138e1562c0f9ef72af37feee.zip
Merge pull request #6790 from QiWang19/set_engine_env
Set engine env from common config
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/root.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 45ca48c39..3bb45f806 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -128,6 +128,21 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
return err
}
+ for _, env := range cfg.Engine.Env {
+ splitEnv := strings.SplitN(env, "=", 2)
+ if len(splitEnv) != 2 {
+ return fmt.Errorf("invalid environment variable for engine %s, valid configuration is KEY=value pair", env)
+ }
+ // skip if the env is already defined
+ if _, ok := os.LookupEnv(splitEnv[0]); ok {
+ logrus.Debugf("environment variable %s is already defined, skip the settings from containers.conf", splitEnv[0])
+ continue
+ }
+ if err := os.Setenv(splitEnv[0], splitEnv[1]); err != nil {
+ return err
+ }
+ }
+
if cmd.Flag("cpu-profile").Changed {
f, err := os.Create(cfg.CPUProfile)
if err != nil {