diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-04-01 09:49:21 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-04-02 13:10:08 -0400 |
commit | 1f8569f7d768c411b5fed4446817c79b4b5337a0 (patch) | |
tree | ee743630732dcad0828ef4880c3c706e50d62c18 /pkg/spec | |
parent | c3c6a7c8236fb43c3bc7172257b7fb15921e1668 (diff) | |
download | podman-1f8569f7d768c411b5fed4446817c79b4b5337a0.tar.gz podman-1f8569f7d768c411b5fed4446817c79b4b5337a0.tar.bz2 podman-1f8569f7d768c411b5fed4446817c79b4b5337a0.zip |
Fix environment handling from containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/spec')
-rw-r--r-- | pkg/spec/spec.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index d4fd5976f..4732af757 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -316,7 +316,17 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM // Make sure to always set the default variables unless overridden in the // config. - config.Env = env.Join(env.DefaultEnvVariables, config.Env) + var defaultEnv map[string]string + if runtimeConfig == nil { + defaultEnv = env.DefaultEnvVariables + } else { + defaultEnv, err = env.ParseSlice(runtimeConfig.Containers.Env) + if err != nil { + return nil, errors.Wrap(err, "Env fields in containers.conf failed ot parse") + } + defaultEnv = env.Join(env.DefaultEnvVariables, defaultEnv) + } + config.Env = env.Join(defaultEnv, config.Env) for name, val := range config.Env { g.AddProcessEnv(name, val) } |