mirror of https://github.com/docker/cli.git
cli/command: remove DockerCli.loadConfigFile()
This makes it more transparent what's happening. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
36441fc5f6
commit
181769f18c
|
@ -132,16 +132,13 @@ func ShowHelp(err io.Writer) func(*cobra.Command, []string) error {
|
||||||
|
|
||||||
// ConfigFile returns the ConfigFile
|
// ConfigFile returns the ConfigFile
|
||||||
func (cli *DockerCli) ConfigFile() *configfile.ConfigFile {
|
func (cli *DockerCli) ConfigFile() *configfile.ConfigFile {
|
||||||
|
// TODO(thaJeztah): when would this happen? Is this only in tests (where cli.Initialize() is not called first?)
|
||||||
if cli.configFile == nil {
|
if cli.configFile == nil {
|
||||||
cli.loadConfigFile()
|
cli.configFile = config.LoadDefaultConfigFile(cli.err)
|
||||||
}
|
}
|
||||||
return cli.configFile
|
return cli.configFile
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DockerCli) loadConfigFile() {
|
|
||||||
cli.configFile = config.LoadDefaultConfigFile(cli.err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServerInfo returns the server version details for the host this client is
|
// ServerInfo returns the server version details for the host this client is
|
||||||
// connected to
|
// connected to
|
||||||
func (cli *DockerCli) ServerInfo() ServerInfo {
|
func (cli *DockerCli) ServerInfo() ServerInfo {
|
||||||
|
@ -225,7 +222,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
|
||||||
return errors.New("conflicting options: either specify --host or --context, not both")
|
return errors.New("conflicting options: either specify --host or --context, not both")
|
||||||
}
|
}
|
||||||
|
|
||||||
cli.loadConfigFile()
|
cli.configFile = config.LoadDefaultConfigFile(cli.err)
|
||||||
|
|
||||||
baseContextStore := store.New(config.ContextStoreDir(), cli.contextStoreConfig)
|
baseContextStore := store.New(config.ContextStoreDir(), cli.contextStoreConfig)
|
||||||
cli.contextStore = &ContextStoreWithDefault{
|
cli.contextStore = &ContextStoreWithDefault{
|
||||||
|
|
Loading…
Reference in New Issue