2016-12-25 14:31:52 -05:00
|
|
|
package credentials
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
|
2017-04-17 18:07:56 -04:00
|
|
|
"github.com/docker/cli/cli/config/configfile"
|
2016-12-25 14:31:52 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// DetectDefaultStore sets the default credentials store
|
|
|
|
// if the host includes the default store helper program.
|
|
|
|
func DetectDefaultStore(c *configfile.ConfigFile) {
|
|
|
|
if c.CredentialsStore != "" {
|
|
|
|
// user defined
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if defaultCredentialsStore != "" {
|
|
|
|
if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil {
|
|
|
|
c.CredentialsStore = defaultCredentialsStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|