summaryrefslogtreecommitdiff
path: root/cmd/podman/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/root.go')
-rw-r--r--cmd/podman/root.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 45ca48c39..eccca3d11 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -10,13 +10,13 @@ import (
"strings"
"github.com/containers/common/pkg/config"
- "github.com/containers/libpod/cmd/podman/registry"
- "github.com/containers/libpod/cmd/podman/validate"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/parallel"
- "github.com/containers/libpod/pkg/rootless"
- "github.com/containers/libpod/pkg/tracing"
- "github.com/containers/libpod/version"
+ "github.com/containers/libpod/v2/cmd/podman/registry"
+ "github.com/containers/libpod/v2/cmd/podman/validate"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/parallel"
+ "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/libpod/v2/pkg/tracing"
+ "github.com/containers/libpod/v2/version"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -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 {