diff --git a/cli/config/credentials/default_store.go b/cli/config/credentials/default_store.go index b2cc4df8bc..7a760f1a97 100644 --- a/cli/config/credentials/default_store.go +++ b/cli/config/credentials/default_store.go @@ -7,13 +7,15 @@ import ( // DetectDefaultStore return the default credentials store for the platform if // the store executable is available. func DetectDefaultStore(store string) string { + platformDefault := defaultCredentialsStore() + // user defined or no default for platform - if store != "" || defaultCredentialsStore == "" { + if store != "" || platformDefault == "" { return store } - if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil { - return defaultCredentialsStore + if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil { + return platformDefault } return "" } diff --git a/cli/config/credentials/default_store_darwin.go b/cli/config/credentials/default_store_darwin.go index 63e8ed4010..5d42dec622 100644 --- a/cli/config/credentials/default_store_darwin.go +++ b/cli/config/credentials/default_store_darwin.go @@ -1,3 +1,5 @@ package credentials -const defaultCredentialsStore = "osxkeychain" +func defaultCredentialsStore() string { + return "osxkeychain" +} diff --git a/cli/config/credentials/default_store_linux.go b/cli/config/credentials/default_store_linux.go index 864c540f6c..8e51385943 100644 --- a/cli/config/credentials/default_store_linux.go +++ b/cli/config/credentials/default_store_linux.go @@ -1,3 +1,5 @@ package credentials -const defaultCredentialsStore = "secretservice" +func defaultCredentialsStore() string { + return "secretservice" +} diff --git a/cli/config/credentials/default_store_windows.go b/cli/config/credentials/default_store_windows.go index fb6a9745cf..bb799ca61b 100644 --- a/cli/config/credentials/default_store_windows.go +++ b/cli/config/credentials/default_store_windows.go @@ -1,3 +1,5 @@ package credentials -const defaultCredentialsStore = "wincred" +func defaultCredentialsStore() string { + return "wincred" +}