abeizn commented on code in PR #5399:
URL: 
https://github.com/apache/incubator-devlake/pull/5399#discussion_r1222513389


##########
backend/core/config/config_viper.go:
##########
@@ -47,15 +47,17 @@ func GetConfig() *viper.Viper {
 func initConfig(v *viper.Viper) {
        v.SetConfigName(getConfigName())
        v.SetConfigType("env")
-       envPath := getEnvPath()
-       // AddConfigPath adds a path for Viper to search for the config file in.
-       v.AddConfigPath("./../../../../..")
-       v.AddConfigPath("./../../../..")
-       v.AddConfigPath("./../../..")
-       v.AddConfigPath("./../..")
-       v.AddConfigPath("./../")
-       v.AddConfigPath("./")
-       v.AddConfigPath(envPath)
+
+       if envFile := os.Getenv("ENV_FILE"); envFile != "" {
+               v.SetConfigFile(envFile)
+       } else {
+               v.SetConfigFile("./.env")

Review Comment:
   @keon94 You are right, according to klesh’s opinion, delete all other paths 
and only keep the current path, but it seems that it cannot be used so easily



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to