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:
Dave Collins 2013-11-15 14:42:53 -06:00
parent 527a08eb14
commit 6b8c10d1fb

View file

@ -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.