summaryrefslogtreecommitdiff
path: root/cmd/podman/shared/parse/parse.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-12 10:33:18 +0200
committerGitHub <noreply@github.com>2019-07-12 10:33:18 +0200
commit6f3e7f7eccdfed03d3d617a9040d5e0b844ea637 (patch)
tree2632afdbee8c1f480ae515453161b65d89866d69 /cmd/podman/shared/parse/parse.go
parent20f11718def2a5bf5af96363e9c7082ba48077f4 (diff)
parent369f8b8862e8918a011290311e44c1691f699c58 (diff)
downloadpodman-6f3e7f7eccdfed03d3d617a9040d5e0b844ea637.tar.gz
podman-6f3e7f7eccdfed03d3d617a9040d5e0b844ea637.tar.bz2
podman-6f3e7f7eccdfed03d3d617a9040d5e0b844ea637.zip
Merge pull request #3557 from rhatdan/env
Add support for --env-host
Diffstat (limited to 'cmd/podman/shared/parse/parse.go')
-rw-r--r--cmd/podman/shared/parse/parse.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmd/podman/shared/parse/parse.go b/cmd/podman/shared/parse/parse.go
index 7bc2652cb..a77002235 100644
--- a/cmd/podman/shared/parse/parse.go
+++ b/cmd/podman/shared/parse/parse.go
@@ -112,9 +112,22 @@ func parseEnv(env map[string]string, line string) error {
if len(data) > 1 {
env[name] = data[1]
} else {
- // if only a pass-through variable is given, clean it up.
- val, _ := os.LookupEnv(name)
- env[name] = val
+ if strings.HasSuffix(name, "*") {
+ name = strings.TrimSuffix(name, "*")
+ for _, e := range os.Environ() {
+ part := strings.SplitN(e, "=", 2)
+ if len(part) < 2 {
+ continue
+ }
+ if strings.HasPrefix(part[0], name) {
+ env[part[0]] = part[1]
+ }
+ }
+ } else {
+ // if only a pass-through variable is given, clean it up.
+ val, _ := os.LookupEnv(name)
+ env[name] = val
+ }
}
return nil
}