config: return an error if unable to parse values in the config file

This commit is contained in:
Olaoluwa Osuntokun 2018-09-12 21:35:27 -07:00
parent c5ece1e509
commit e23f889639
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

View File

@ -345,7 +345,14 @@ func loadConfig() (*config, error) {
var configFileError error
cfg := preCfg
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