From 331086663fed9ca73c013abdf3a6ab46fd81bc26 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Thu, 18 Nov 2021 09:00:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BB=E5=8F=96=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=85=8D=E7=BD=AE=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/logger/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/infra/logger/config.go b/infra/logger/config.go index 8b5da20..e7fb9b2 100644 --- a/infra/logger/config.go +++ b/infra/logger/config.go @@ -1,6 +1,7 @@ package logger import ( + "LAPP_GAAS_GFrame_BACKEND/utils" "errors" "github.com/spf13/viper" ) @@ -48,9 +49,13 @@ type outputSettings struct { func InitConfig() error { var err error + baseDir, err := utils.GetCurrentPath("conf") + if err != nil { + return err + } viper.SetConfigName("log_config") viper.SetConfigType("yaml") - viper.AddConfigPath("./conf/") + viper.AddConfigPath(baseDir) if err = viper.ReadInConfig(); err != nil { return err }