diff --git a/infra/config/config.go b/infra/config/config.go index f3e1ba0..c48ee74 100644 --- a/infra/config/config.go +++ b/infra/config/config.go @@ -3,7 +3,6 @@ package config import ( "LAPP_ETL/utils" "github.com/spf13/viper" - "path" ) var AppConfig Config @@ -48,13 +47,13 @@ type ETCD struct { } func InitConfig() (err error) { - baseDir, err := utils.GetCurrentPath("/conf") + baseDir, err := utils.GetCurrentPath("conf") if err != nil { return } viper.SetConfigName("app_config") viper.SetConfigType("yaml") - viper.AddConfigPath(path.Join(baseDir, "../conf/")) + viper.AddConfigPath(baseDir) if err = viper.ReadInConfig(); err != nil { return } diff --git a/infra/logger/config.go b/infra/logger/config.go index 8b5da20..d43dd52 100644 --- a/infra/logger/config.go +++ b/infra/logger/config.go @@ -1,6 +1,7 @@ package logger import ( + "LAPP_ETL/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 }