Fix #606, Fix #610 [change] app, config: add symlink support, allow to specify absolute path in log_file

This commit is contained in:
Aleksey Dmitrevskiy
2019-03-14 18:06:53 +03:00
parent f857ed74ec
commit e9d20651e9
2 changed files with 13 additions and 3 deletions

View File

@@ -137,9 +137,15 @@ var config = configuration{
// getConfigFilename returns path to the current config file
func (c *configuration) getConfigFilename() string {
configFile := config.ourConfigFilename
configFile, err := filepath.EvalSymlinks(config.ourConfigFilename)
if err != nil {
if !os.IsNotExist(err) {
log.Error("unexpected error while config file path evaluation: %s", err)
}
configFile = config.ourConfigFilename
}
if !filepath.IsAbs(configFile) {
configFile = filepath.Join(config.ourWorkingDir, config.ourConfigFilename)
configFile = filepath.Join(config.ourWorkingDir, configFile)
}
return configFile
}