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


##########
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:
   @abeizn Is there a reason to just default to the current dir? I'd have kept 
the list of parent paths as before:
   i.e.
   ```go
   v.AddConfigPath("./../../.env")
   v.AddConfigPath("./../.env")
   //etc
   ```



-- 
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