Browse code

Set default credentials store in Windows.

Use the Windows Credentials Manager when the helper
is installed in the path.

Signed-off-by: David Calavera <david.calavera@gmail.com>

David Calavera authored on 2016/03/01 07:03:52
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+package credentials
1
+
2
+import (
3
+	"os/exec"
4
+
5
+	"github.com/docker/docker/cliconfig"
6
+)
7
+
8
+// DetectDefaultStore sets the default credentials store
9
+// if the host includes the default store helper program.
10
+func DetectDefaultStore(c *cliconfig.ConfigFile) {
11
+	if c.CredentialsStore != "" {
12
+		// user defined
13
+		return
14
+	}
15
+
16
+	if defaultCredentialsStore != "" {
17
+		if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil {
18
+			c.CredentialsStore = defaultCredentialsStore
19
+		}
20
+	}
21
+}
... ...
@@ -1,22 +1,3 @@
1 1
 package credentials
2 2
 
3
-import (
4
-	"os/exec"
5
-
6
-	"github.com/docker/docker/cliconfig"
7
-)
8
-
9 3
 const defaultCredentialsStore = "osxkeychain"
10
-
11
-// DetectDefaultStore sets the default credentials store
12
-// if the host includes the default store helper program.
13
-func DetectDefaultStore(c *cliconfig.ConfigFile) {
14
-	if c.CredentialsStore != "" {
15
-		// user defined
16
-		return
17
-	}
18
-
19
-	if _, err := exec.LookPath(remoteCredentialsPrefix + c.CredentialsStore); err == nil {
20
-		c.CredentialsStore = defaultCredentialsStore
21
-	}
22
-}
23 4
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+// +build !windows,!darwin
1
+
2
+package credentials
3
+
4
+const defaultCredentialsStore = ""
0 5
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-// +build !darwin
2
-
3
-package credentials
4
-
5
-import "github.com/docker/docker/cliconfig"
6
-
7
-// DetectDefaultStore sets the default credentials store
8
-// if the host includes the default store helper program.
9
-// This operation is only supported in Darwin.
10
-func DetectDefaultStore(c *cliconfig.ConfigFile) {
11
-}
12 1
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+package credentials
1
+
2
+const defaultCredentialsStore = "wincred"