Ver Fonte

Merge pull request #20796 from calavera/default_windows_creds_helper

Set default credentials store in Windows.
Sebastiaan van Stijn há 9 anos atrás
pai
commit
9c7e1aeeb1

+ 22 - 0
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
+		}
+	}
+}

+ 0 - 19
cliconfig/credentials/default_store_darwin.go

@@ -1,22 +1,3 @@
 package credentials
 package credentials
 
 
-import (
-	"os/exec"
-
-	"github.com/docker/docker/cliconfig"
-)
-
 const defaultCredentialsStore = "osxkeychain"
 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
-	}
-}

+ 5 - 0
cliconfig/credentials/default_store_unix.go

@@ -0,0 +1,5 @@
+// +build !windows,!darwin
+
+package credentials
+
+const defaultCredentialsStore = ""

+ 0 - 11
cliconfig/credentials/default_store_unsupported.go

@@ -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) {
-}

+ 3 - 0
cliconfig/credentials/default_store_windows.go

@@ -0,0 +1,3 @@
+package credentials
+
+const defaultCredentialsStore = "wincred"