mirror of https://github.com/docker/cli.git
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>
This commit is contained in:
parent
10e292dbab
commit
4cf1849418
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue