summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-02-19 15:55:14 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-03 11:47:24 +0100
commitad8e0e5e49a96146d52cfa41945afbe973ba30af (patch)
tree0ac13e0869ade22faf212a0cf2602ac832d90820 /pkg/spec
parent1641ee61802ad5e13a9ddf0a20099fe31f73768d (diff)
downloadpodman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.tar.gz
podman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.tar.bz2
podman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.zip
consolidate env handling into pkg/env
Env-variable related code is scattered across several packages making it hard to maintain and extend. Consolidate the code into a new pkg/env package. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/spec.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index a4ae22efd..77f8bc657 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -7,6 +7,7 @@ import (
libpodconfig "github.com/containers/libpod/libpod/config"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/cgroups"
+ "github.com/containers/libpod/pkg/env"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/sysinfo"
"github.com/docker/go-units"
@@ -150,7 +151,6 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM
for key, val := range config.Annotations {
g.AddAnnotation(key, val)
}
- g.AddProcessEnv("container", "podman")
addedResources := false
@@ -292,6 +292,9 @@ 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)
for name, val := range config.Env {
g.AddProcessEnv(name, val)
}