Merge pull request #1273 from wyxloading/config_race

Fix data race about config
This commit is contained in:
Chris Lu 2020-04-13 22:24:51 -07:00 committed by GitHub
commit 23715af402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,7 +42,8 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {
}
func GetViper() *viper.Viper {
v := viper.GetViper()
v := &viper.Viper{}
*v = *viper.GetViper()
v.AutomaticEnv()
v.SetEnvPrefix("weed")
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))