default_store.go 510 B

12345678910111213141516171819202122
  1. package credentials
  2. import (
  3. "os/exec"
  4. "github.com/docker/docker/cliconfig/configfile"
  5. )
  6. // DetectDefaultStore sets the default credentials store
  7. // if the host includes the default store helper program.
  8. func DetectDefaultStore(c *configfile.ConfigFile) {
  9. if c.CredentialsStore != "" {
  10. // user defined
  11. return
  12. }
  13. if defaultCredentialsStore != "" {
  14. if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil {
  15. c.CredentialsStore = defaultCredentialsStore
  16. }
  17. }
  18. }