2016-02-29 17:03:52 -05:00
|
|
|
package credentials
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
|
2016-04-21 18:37:08 -04:00
|
|
|
"github.com/docker/docker/cliconfig/configfile"
|
2016-02-29 17:03:52 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// DetectDefaultStore sets the default credentials store
|
|
|
|
// if the host includes the default store helper program.
|
2016-04-21 18:37:08 -04:00
|
|
|
func DetectDefaultStore(c *configfile.ConfigFile) {
|
2016-02-29 17:03:52 -05:00
|
|
|
if c.CredentialsStore != "" {
|
|
|
|
// user defined
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if defaultCredentialsStore != "" {
|
|
|
|
if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil {
|
|
|
|
c.CredentialsStore = defaultCredentialsStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|