Move missing config file warn just before return.
The warning about a missing config file should only be shown after all other configuration has succeeded so it's not shown when there are invalid options specified. Also add a comment about it where its intended placement is for the future.
This commit is contained in:
parent
d33e9b4165
commit
4f8c2a3aaf
1 changed files with 7 additions and 7 deletions
14
config.go
14
config.go
|
@ -487,13 +487,6 @@ func loadConfig() (*config, []string, error) {
|
||||||
cfg.ConnectPeers = normalizeAddresses(cfg.ConnectPeers,
|
cfg.ConnectPeers = normalizeAddresses(cfg.ConnectPeers,
|
||||||
activeNetParams.peerPort)
|
activeNetParams.peerPort)
|
||||||
|
|
||||||
// Warn about missing config file after the final command line parse
|
|
||||||
// succeeds. This prevents the warning on help messages and invalid
|
|
||||||
// options.
|
|
||||||
if configFileError != nil {
|
|
||||||
btcdLog.Warnf("%v", configFileError)
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.dial = net.Dial
|
cfg.dial = net.Dial
|
||||||
cfg.lookup = net.LookupIP
|
cfg.lookup = net.LookupIP
|
||||||
if cfg.Proxy != "" {
|
if cfg.Proxy != "" {
|
||||||
|
@ -535,6 +528,13 @@ func loadConfig() (*config, []string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warn about missing config file only after all other configuration is
|
||||||
|
// done. This prevents the warning on help messages and invalid
|
||||||
|
// options. Note this should go directly before the return.
|
||||||
|
if configFileError != nil {
|
||||||
|
btcdLog.Warnf("%v", configFileError)
|
||||||
|
}
|
||||||
|
|
||||||
return &cfg, remainingArgs, nil
|
return &cfg, remainingArgs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue