cmd/dockerd: loadDaemonCliConfig(): minor cleanup
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d9d0683862
commit
7b3463f2c5
1 changed files with 12 additions and 11 deletions
|
@ -390,21 +390,26 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
|||
conf.Hosts = opts.Hosts
|
||||
conf.LogLevel = opts.LogLevel
|
||||
|
||||
if opts.flags.Changed(FlagTLS) {
|
||||
if flags.Changed("graph") && flags.Changed("data-root") {
|
||||
return nil, errors.New(`cannot specify both "--graph" and "--data-root" option`)
|
||||
}
|
||||
if flags.Changed(FlagTLS) {
|
||||
conf.TLS = &opts.TLS
|
||||
}
|
||||
if opts.flags.Changed(FlagTLSVerify) {
|
||||
if flags.Changed(FlagTLSVerify) {
|
||||
conf.TLSVerify = &opts.TLSVerify
|
||||
v := true
|
||||
conf.TLS = &v
|
||||
}
|
||||
|
||||
conf.CommonTLSOptions = config.CommonTLSOptions{}
|
||||
|
||||
if opts.TLSOptions != nil {
|
||||
conf.CommonTLSOptions.CAFile = opts.TLSOptions.CAFile
|
||||
conf.CommonTLSOptions.CertFile = opts.TLSOptions.CertFile
|
||||
conf.CommonTLSOptions.KeyFile = opts.TLSOptions.KeyFile
|
||||
conf.CommonTLSOptions = config.CommonTLSOptions{
|
||||
CAFile: opts.TLSOptions.CAFile,
|
||||
CertFile: opts.TLSOptions.CertFile,
|
||||
KeyFile: opts.TLSOptions.KeyFile,
|
||||
}
|
||||
} else {
|
||||
conf.CommonTLSOptions = config.CommonTLSOptions{}
|
||||
}
|
||||
|
||||
if conf.TrustKeyPath == "" {
|
||||
|
@ -415,10 +420,6 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
|||
conf.TrustKeyPath = filepath.Join(daemonConfDir, defaultTrustKeyFile)
|
||||
}
|
||||
|
||||
if flags.Changed("graph") && flags.Changed("data-root") {
|
||||
return nil, errors.New(`cannot specify both "--graph" and "--data-root" option`)
|
||||
}
|
||||
|
||||
if opts.configFile != "" {
|
||||
c, err := config.MergeDaemonConfigurations(conf, flags, opts.configFile)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue