mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-05 05:36:54 +00:00
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
14
config.go
14
config.go
@ -487,13 +487,6 @@ func loadConfig() (*config, []string, error) {
|
||||
cfg.ConnectPeers = normalizeAddresses(cfg.ConnectPeers,
|
||||
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.lookup = net.LookupIP
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user