From 7a0091777d5bf9dba807472c100cd0d10c683bfc Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Mon, 16 Jan 2023 10:59:33 +0300 Subject: [PATCH] Fix relative config path #171 --- cmd/app/app.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/app/app.go b/cmd/app/app.go index 776b2f14..21741e5b 100644 --- a/cmd/app/app.go +++ b/cmd/app/app.go @@ -8,7 +8,7 @@ import ( "gopkg.in/yaml.v3" "io" "os" - "path" + "path/filepath" "runtime" "strings" ) @@ -52,8 +52,10 @@ func Init() { } if ConfigPath != "" { - if cwd, err := os.Getwd(); err == nil { - ConfigPath = path.Join(cwd, ConfigPath) + if !filepath.IsAbs(ConfigPath) { + if cwd, err := os.Getwd(); err == nil { + ConfigPath = filepath.Join(cwd, ConfigPath) + } } Info["config_path"] = ConfigPath }