diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-04-14 11:00:40 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-04-14 14:48:37 -0700 |
commit | d51727642603ba160a7898ee4597d0f071cdea44 (patch) | |
tree | c2b3a369924f29ddf1762d32941dd10b38da2b9d /cmd/podmanV2/main.go | |
parent | 0d01f09bf4103538a6011019b690e5aa11c377db (diff) | |
download | podman-d51727642603ba160a7898ee4597d0f071cdea44.tar.gz podman-d51727642603ba160a7898ee4597d0f071cdea44.tar.bz2 podman-d51727642603ba160a7898ee4597d0f071cdea44.zip |
Add support for the global flags and config files
Note: This PR doesn't provide full rootless support that will be
addressed in a future PR
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podmanV2/main.go')
-rw-r--r-- | cmd/podmanV2/main.go | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/cmd/podmanV2/main.go b/cmd/podmanV2/main.go index fe3cd9f16..cfe20d1c1 100644 --- a/cmd/podmanV2/main.go +++ b/cmd/podmanV2/main.go @@ -3,8 +3,6 @@ package main import ( "os" "reflect" - "runtime" - "strings" _ "github.com/containers/libpod/cmd/podmanV2/containers" _ "github.com/containers/libpod/cmd/podmanV2/healthcheck" @@ -14,36 +12,13 @@ import ( "github.com/containers/libpod/cmd/podmanV2/registry" _ "github.com/containers/libpod/cmd/podmanV2/system" _ "github.com/containers/libpod/cmd/podmanV2/volumes" - "github.com/containers/libpod/libpod" - "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/storage/pkg/reexec" - "github.com/sirupsen/logrus" ) func init() { - if err := libpod.SetXdgDirs(); err != nil { - logrus.Errorf(err.Error()) - os.Exit(1) - } - - switch runtime.GOOS { - case "darwin": - fallthrough - case "windows": - registry.EngineOptions.EngineMode = entities.TunnelMode - case "linux": - registry.EngineOptions.EngineMode = entities.ABIMode - default: - logrus.Errorf("%s is not a supported OS", runtime.GOOS) - os.Exit(1) - } - - // TODO: Is there a Cobra way to "peek" at os.Args? - for _, v := range os.Args { - if strings.HasPrefix(v, "--remote") { - registry.EngineOptions.EngineMode = entities.TunnelMode - } - } + // This is the bootstrap configuration, if user gives + // CLI flags parts of this configuration may be overwritten + registry.PodmanOptions = registry.NewPodmanConfig() } func main() { @@ -53,7 +28,7 @@ func main() { return } for _, c := range registry.Commands { - if Contains(registry.EngineOptions.EngineMode, c.Mode) { + if Contains(registry.PodmanOptions.EngineMode, c.Mode) { parent := rootCmd if c.Parent != nil { parent = c.Parent |