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>
22 lines
487 B
Go
22 lines
487 B
Go
package credentials
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
// 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 != "" || platformDefault == "" {
|
|
return store
|
|
}
|
|
|
|
if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil {
|
|
return platformDefault
|
|
}
|
|
return ""
|
|
}
|