2016-12-25 14:31:52 -05:00
|
|
|
package credentials
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
2017-06-21 16:47:06 -04:00
|
|
|
// DetectDefaultStore return the default credentials store for the platform if
|
|
|
|
// the store executable is available.
|
|
|
|
func DetectDefaultStore(store string) string {
|
|
|
|
// user defined or no default for platform
|
|
|
|
if store != "" || defaultCredentialsStore == "" {
|
|
|
|
return store
|
2016-12-25 14:31:52 -05:00
|
|
|
}
|
|
|
|
|
2017-06-21 16:47:06 -04:00
|
|
|
if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil {
|
|
|
|
return defaultCredentialsStore
|
2016-12-25 14:31:52 -05:00
|
|
|
}
|
2017-06-21 16:47:06 -04:00
|
|
|
return ""
|
2016-12-25 14:31:52 -05:00
|
|
|
}
|