diff --git a/cliconfig/credentials/default_store.go b/cliconfig/credentials/default_store.go new file mode 100644 index 0000000000..b5fc47ccb3 --- /dev/null +++ b/cliconfig/credentials/default_store.go @@ -0,0 +1,22 @@ +package credentials + +import ( + "os/exec" + + "github.com/docker/docker/cliconfig" +) + +// DetectDefaultStore sets the default credentials store +// if the host includes the default store helper program. +func DetectDefaultStore(c *cliconfig.ConfigFile) { + if c.CredentialsStore != "" { + // user defined + return + } + + if defaultCredentialsStore != "" { + if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil { + c.CredentialsStore = defaultCredentialsStore + } + } +} diff --git a/cliconfig/credentials/default_store_darwin.go b/cliconfig/credentials/default_store_darwin.go index ad76187f6e..63e8ed4010 100644 --- a/cliconfig/credentials/default_store_darwin.go +++ b/cliconfig/credentials/default_store_darwin.go @@ -1,22 +1,3 @@ package credentials -import ( - "os/exec" - - "github.com/docker/docker/cliconfig" -) - const defaultCredentialsStore = "osxkeychain" - -// DetectDefaultStore sets the default credentials store -// if the host includes the default store helper program. -func DetectDefaultStore(c *cliconfig.ConfigFile) { - if c.CredentialsStore != "" { - // user defined - return - } - - if _, err := exec.LookPath(remoteCredentialsPrefix + c.CredentialsStore); err == nil { - c.CredentialsStore = defaultCredentialsStore - } -} diff --git a/cliconfig/credentials/default_store_unix.go b/cliconfig/credentials/default_store_unix.go new file mode 100644 index 0000000000..cdb909a6bc --- /dev/null +++ b/cliconfig/credentials/default_store_unix.go @@ -0,0 +1,5 @@ +// +build !windows,!darwin + +package credentials + +const defaultCredentialsStore = "" diff --git a/cliconfig/credentials/default_store_unsupported.go b/cliconfig/credentials/default_store_unsupported.go deleted file mode 100644 index 724d598865..0000000000 --- a/cliconfig/credentials/default_store_unsupported.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !darwin - -package credentials - -import "github.com/docker/docker/cliconfig" - -// DetectDefaultStore sets the default credentials store -// if the host includes the default store helper program. -// This operation is only supported in Darwin. -func DetectDefaultStore(c *cliconfig.ConfigFile) { -} diff --git a/cliconfig/credentials/default_store_windows.go b/cliconfig/credentials/default_store_windows.go new file mode 100644 index 0000000000..fb6a9745cf --- /dev/null +++ b/cliconfig/credentials/default_store_windows.go @@ -0,0 +1,3 @@ +package credentials + +const defaultCredentialsStore = "wincred"