config: return an error if unable to parse values in the config file
This commit is contained in:
parent
c5ece1e509
commit
e23f889639
@ -345,7 +345,14 @@ func loadConfig() (*config, error) {
|
|||||||
var configFileError error
|
var configFileError error
|
||||||
cfg := preCfg
|
cfg := preCfg
|
||||||
if err := flags.IniParse(configFilePath, &cfg); err != nil {
|
if err := flags.IniParse(configFilePath, &cfg); err != nil {
|
||||||
configFileError = err
|
// If it's a parsing related error, then we'll return
|
||||||
|
// immediately, otherwise we can proceed as possibly the config
|
||||||
|
// file doesn't exist which is OK.
|
||||||
|
if _, ok := err.(*flags.IniError); ok {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
configFileError = err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, parse the remaining command line options again to ensure
|
// Finally, parse the remaining command line options again to ensure
|
||||||
|
Loading…
Reference in New Issue
Block a user