Commit 1c293781 by Andris Raugulis Committed by Torkel Ödegaard

Log to default log directory, only if custom configuration failed. (#5393)

parent 603e5fe0
......@@ -284,19 +284,19 @@ func evalConfigValues() {
}
}
func loadSpecifedConfigFile(configFile string) {
func loadSpecifedConfigFile(configFile string) error {
if configFile == "" {
configFile = filepath.Join(HomePath, "conf/custom.ini")
// return without error if custom file does not exist
if !pathExists(configFile) {
return
return nil
}
}
userConfig, err := ini.Load(configFile)
userConfig.BlockMode = false
if err != nil {
log.Fatal(3, "Failed to parse %v, %v", configFile, err)
return fmt.Errorf("Failed to parse %v, %v", configFile, err)
}
for _, section := range userConfig.Sections() {
......@@ -318,6 +318,7 @@ func loadSpecifedConfigFile(configFile string) {
}
configFiles = append(configFiles, configFile)
return nil
}
func loadConfiguration(args *CommandLineArgs) {
......@@ -339,12 +340,12 @@ func loadConfiguration(args *CommandLineArgs) {
// load default overrides
applyCommandLineDefaultProperties(commandLineProps)
// init logging before specific config so we can log errors from here on
DataPath = makeAbsolute(Cfg.Section("paths").Key("data").String(), HomePath)
initLogging()
// load specified config file
loadSpecifedConfigFile(args.Config)
err = loadSpecifedConfigFile(args.Config)
if err != nil {
initLogging()
log.Fatal(3, err.Error())
}
// apply environment overrides
applyEnvVariableOverrides()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment