mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Refactor cliconfig so that the default constructor can exist in the package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
33c9edaf6c
commit
30e3620eae
10 changed files with 243 additions and 221 deletions
|
|
@ -3,12 +3,12 @@ package credentials
|
|||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/cliconfig/configfile"
|
||||
)
|
||||
|
||||
// DetectDefaultStore sets the default credentials store
|
||||
// if the host includes the default store helper program.
|
||||
func DetectDefaultStore(c *cliconfig.ConfigFile) {
|
||||
func DetectDefaultStore(c *configfile.ConfigFile) {
|
||||
if c.CredentialsStore != "" {
|
||||
// user defined
|
||||
return
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@ package credentials
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/cliconfig/configfile"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// fileStore implements a credentials store using
|
||||
// the docker configuration file to keep the credentials in plain text.
|
||||
type fileStore struct {
|
||||
file *cliconfig.ConfigFile
|
||||
file *configfile.ConfigFile
|
||||
}
|
||||
|
||||
// NewFileStore creates a new file credentials store.
|
||||
func NewFileStore(file *cliconfig.ConfigFile) Store {
|
||||
func NewFileStore(file *configfile.ConfigFile) Store {
|
||||
return &fileStore{
|
||||
file: file,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/cliconfig/configfile"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func newConfigFile(auths map[string]types.AuthConfig) *cliconfig.ConfigFile {
|
||||
func newConfigFile(auths map[string]types.AuthConfig) *configfile.ConfigFile {
|
||||
tmp, _ := ioutil.TempFile("", "docker-test")
|
||||
name := tmp.Name()
|
||||
tmp.Close()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/cliconfig/configfile"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ type nativeStore struct {
|
|||
|
||||
// NewNativeStore creates a new native store that
|
||||
// uses a remote helper program to manage credentials.
|
||||
func NewNativeStore(file *cliconfig.ConfigFile) Store {
|
||||
func NewNativeStore(file *configfile.ConfigFile) Store {
|
||||
return &nativeStore{
|
||||
commandFn: shellCommandFn(file.CredentialsStore),
|
||||
fileStore: NewFileStore(file),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue