From 8268ba66811dbbe99eb90bf9c9816371776245ef Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Thu, 9 Nov 2023 13:20:29 +0100 Subject: [PATCH] #107 Ensure that env variable PODMAN_BIN wins (#108) Signed-off-by: Gerd Aschemann Signed-off-by: Emily McMullan --- cmd/settings.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/settings.go b/cmd/settings.go index 34c9c70..6575085 100644 --- a/cmd/settings.go +++ b/cmd/settings.go @@ -26,10 +26,14 @@ type Config struct { } func (c *Config) Load() error { - podmanPath, _ := exec.LookPath("podman") - if podmanPath != c.PodmanBinary && (podmanPath != "" || len(podmanPath) > 0) { - os.Setenv("PODMAN_BIN", podmanPath) + envValue := os.Getenv("PODMAN_BIN") + if envValue == "" { + podmanPath, _ := exec.LookPath("podman") + if podmanPath != c.PodmanBinary && (podmanPath != "" || len(podmanPath) > 0) { + os.Setenv("PODMAN_BIN", podmanPath) + } } + err := env.Set(c) if err != nil { return err