|
@@ -51,8 +51,8 @@ func newDaemonOptions(config *config.Config) *daemonOptions {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// InstallFlags adds flags for the common options on the FlagSet
|
|
|
-func (o *daemonOptions) InstallFlags(flags *pflag.FlagSet) {
|
|
|
+// installFlags adds flags for the common options on the FlagSet
|
|
|
+func (o *daemonOptions) installFlags(flags *pflag.FlagSet) {
|
|
|
if dockerCertPath == "" {
|
|
|
// cliconfig.Dir returns $DOCKER_CONFIG or ~/.docker.
|
|
|
// cliconfig.Dir does not look up $XDG_CONFIG_HOME
|
|
@@ -77,18 +77,18 @@ func (o *daemonOptions) InstallFlags(flags *pflag.FlagSet) {
|
|
|
flags.VarP(hostOpt, "host", "H", "Daemon socket(s) to connect to")
|
|
|
}
|
|
|
|
|
|
-// SetDefaultOptions sets default values for options after flag parsing is
|
|
|
+// setDefaultOptions sets default values for options after flag parsing is
|
|
|
// complete
|
|
|
-func (o *daemonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
|
|
|
+func (o *daemonOptions) setDefaultOptions() {
|
|
|
// Regardless of whether the user sets it to true or false, if they
|
|
|
// specify --tlsverify at all then we need to turn on TLS
|
|
|
// TLSVerify can be true even if not set due to DOCKER_TLS_VERIFY env var, so we need
|
|
|
// to check that here as well
|
|
|
- if flags.Changed(FlagTLSVerify) || o.TLSVerify {
|
|
|
+ if o.flags.Changed(FlagTLSVerify) || o.TLSVerify {
|
|
|
o.TLS = true
|
|
|
}
|
|
|
|
|
|
- if o.TLS && !flags.Changed(FlagTLSVerify) {
|
|
|
+ if o.TLS && !o.flags.Changed(FlagTLSVerify) {
|
|
|
// Enable tls verification unless explicitly disabled
|
|
|
o.TLSVerify = true
|
|
|
}
|
|
@@ -96,19 +96,18 @@ func (o *daemonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
|
|
|
if !o.TLS {
|
|
|
o.TLSOptions = nil
|
|
|
} else {
|
|
|
- tlsOptions := o.TLSOptions
|
|
|
- tlsOptions.InsecureSkipVerify = !o.TLSVerify
|
|
|
+ o.TLSOptions.InsecureSkipVerify = !o.TLSVerify
|
|
|
|
|
|
// Reset CertFile and KeyFile to empty string if the user did not specify
|
|
|
// the respective flags and the respective default files were not found.
|
|
|
- if !flags.Changed("tlscert") {
|
|
|
- if _, err := os.Stat(tlsOptions.CertFile); os.IsNotExist(err) {
|
|
|
- tlsOptions.CertFile = ""
|
|
|
+ if !o.flags.Changed("tlscert") {
|
|
|
+ if _, err := os.Stat(o.TLSOptions.CertFile); os.IsNotExist(err) {
|
|
|
+ o.TLSOptions.CertFile = ""
|
|
|
}
|
|
|
}
|
|
|
- if !flags.Changed("tlskey") {
|
|
|
- if _, err := os.Stat(tlsOptions.KeyFile); os.IsNotExist(err) {
|
|
|
- tlsOptions.KeyFile = ""
|
|
|
+ if !o.flags.Changed("tlskey") {
|
|
|
+ if _, err := os.Stat(o.TLSOptions.KeyFile); os.IsNotExist(err) {
|
|
|
+ o.TLSOptions.KeyFile = ""
|
|
|
}
|
|
|
}
|
|
|
}
|