mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
defaultCredentialStore: make this a function
In the next patch, we'll use this to implement some logic about which
password backend to use.
Signed-off-by: Tycho Andersen <tycho@docker.com>
Upstream-commit: 4cf1849418
Component: cli
This commit is contained in:
@@ -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 ""
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package credentials
|
||||
|
||||
const defaultCredentialsStore = "osxkeychain"
|
||||
func defaultCredentialsStore() string {
|
||||
return "osxkeychain"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package credentials
|
||||
|
||||
const defaultCredentialsStore = "secretservice"
|
||||
func defaultCredentialsStore() string {
|
||||
return "secretservice"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package credentials
|
||||
|
||||
const defaultCredentialsStore = "wincred"
|
||||
func defaultCredentialsStore() string {
|
||||
return "wincred"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user