Don't load default config file in regtest mode.
The regression test mode is special and therefore most likely will not want to use the same settings that are in the configuration file. The -C option can still be used to specify a config file in regression test mode if desired.
This commit is contained in:
parent
527a08eb14
commit
6b8c10d1fb
1 changed files with 9 additions and 7 deletions
16
config.go
16
config.go
|
@ -225,14 +225,16 @@ func loadConfig() (*config, []string, error) {
|
|||
|
||||
// Load additional config from file.
|
||||
parser := flags.NewParser(&cfg, flags.Default)
|
||||
err := parser.ParseIniFile(preCfg.ConfigFile)
|
||||
if err != nil {
|
||||
if _, ok := err.(*os.PathError); !ok {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
parser.WriteHelp(os.Stderr)
|
||||
return nil, nil, err
|
||||
if !preCfg.RegressionTest || preCfg.ConfigFile != defaultConfigFile {
|
||||
err := parser.ParseIniFile(preCfg.ConfigFile)
|
||||
if err != nil {
|
||||
if _, ok := err.(*os.PathError); !ok {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
parser.WriteHelp(os.Stderr)
|
||||
return nil, nil, err
|
||||
}
|
||||
log.Warnf("%v", err)
|
||||
}
|
||||
log.Warnf("%v", err)
|
||||
}
|
||||
|
||||
// Don't add peers from the config file when in regression test mode.
|
||||
|
|
Loading…
Reference in a new issue