mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #20796 from calavera/default_windows_creds_helper
Set default credentials store in Windows.
This commit is contained in:
commit
9c7e1aeeb1
5 changed files with 30 additions and 30 deletions
22
cliconfig/credentials/default_store.go
Normal file
22
cliconfig/credentials/default_store.go
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
cliconfig/credentials/default_store_unix.go
Normal file
5
cliconfig/credentials/default_store_unix.go
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// +build !windows,!darwin
|
||||||
|
|
||||||
|
package credentials
|
||||||
|
|
||||||
|
const defaultCredentialsStore = ""
|
|
@ -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
cliconfig/credentials/default_store_windows.go
Normal file
3
cliconfig/credentials/default_store_windows.go
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
package credentials
|
||||||
|
|
||||||
|
const defaultCredentialsStore = "wincred"
|
Loading…
Add table
Add a link
Reference in a new issue