aboutsummaryrefslogtreecommitdiff
path: root/pkg/specgenutil
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-08-24 11:22:33 +0530
committerAditya R <arajan@redhat.com>2022-08-24 14:06:25 +0530
commitb4584ea8546be227c74174130ec3a04a93996d28 (patch)
treea18b2250fbbbc64f297415df7e27b37c2e659352 /pkg/specgenutil
parent2538bea8da2a4dba96f1c80594a66f6319d2d872 (diff)
downloadpodman-b4584ea8546be227c74174130ec3a04a93996d28.tar.gz
podman-b4584ea8546be227c74174130ec3a04a93996d28.tar.bz2
podman-b4584ea8546be227c74174130ec3a04a93996d28.zip
run,create: add support for --env-merge for preprocessing vars
Allow end users to preprocess default environment variables before injecting them into container using `--env-merge` Usage ``` podman run -it --rm --env-merge some=${some}-edit --env-merge some2=${some2}-edit2 myimage sh ``` Closes: https://github.com/containers/podman/issues/15288 Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg/specgenutil')
-rw-r--r--pkg/specgenutil/specgen.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 7392e7b44..aab2eebd5 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -839,6 +839,9 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
if !s.Volatile {
s.Volatile = c.Rm
}
+ if len(s.EnvMerge) == 0 || len(c.EnvMerge) != 0 {
+ s.EnvMerge = c.EnvMerge
+ }
if len(s.UnsetEnv) == 0 || len(c.UnsetEnv) != 0 {
s.UnsetEnv = c.UnsetEnv
}