From d27e71374e89b3c88b486f8a7015185c9fe13ea9 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 12 Aug 2019 14:11:53 -0400 Subject: Use GetRuntimeDir to setup auth.json for login Signed-off-by: Daniel J Walsh --- cmd/podman/shared/funcs.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd/podman/shared') diff --git a/cmd/podman/shared/funcs.go b/cmd/podman/shared/funcs.go index 2ceb9cdcb..bb4eed1e3 100644 --- a/cmd/podman/shared/funcs.go +++ b/cmd/podman/shared/funcs.go @@ -6,6 +6,7 @@ import ( "path/filepath" "strings" + "github.com/containers/libpod/pkg/util" "github.com/google/shlex" ) @@ -13,13 +14,14 @@ func GetAuthFile(authfile string) string { if authfile != "" { return authfile } + authfile = os.Getenv("REGISTRY_AUTH_FILE") if authfile != "" { return authfile } - runtimeDir := os.Getenv("XDG_RUNTIME_DIR") - if runtimeDir != "" { - return filepath.Join(runtimeDir, "containers/auth.json") + + if runtimeDir, err := util.GetRuntimeDir(); err == nil { + return filepath.Join(runtimeDir, "auth.json") } return "" } -- cgit v1.2.3-54-g00ecf