From 6e3fd735a9c0e7b8d01806b6b10d04a08a74f5de Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Sat, 18 Dec 2021 15:38:52 +0800 Subject: [PATCH] fix env config --- common/config_utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/config_utils.go b/common/config_utils.go index b17e9ce..44c93f6 100644 --- a/common/config_utils.go +++ b/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) }