Browse Source

fix env config

topic
yedf2 5 years ago
parent
commit
6e3fd735a9
  1. 4
      common/config_utils.go

4
common/config_utils.go

@ -47,7 +47,9 @@ func loadFromEnvInner(prefix string, conf reflect.Value, defaultValue string) {
}
func toUnderscoreUpper(key string) string {
matchFirstCap := regexp.MustCompile("([a-z])([A-Z]+[a-z]+)")
key = strings.Trim(key, "_")
matchFirstCap := regexp.MustCompile("([a-z])([A-Z]+)")
s2 := matchFirstCap.ReplaceAllString(key, "${1}_${2}")
// dtmimp.Logf("loading from env: %s", strings.ToUpper(s2))
return strings.ToUpper(s2)
}

Loading…
Cancel
Save