AlexStocks commented on code in PR #2014:
URL: https://github.com/apache/dubbo-go/pull/2014#discussion_r944075562
##########
config/config_resolver.go:
##########
@@ -66,5 +73,39 @@ func GetConfigResolver(conf *loaderConf) *koanf.Koanf {
if err != nil {
panic(err)
}
- return k
+ return resolvePlaceholder(k)
+}
+
+const (
+ PlaceholderPrefix = "${"
+ PlaceholderSuffix = "}"
+)
+
+// resolvePlaceholder replace ${xx} with real value
+func resolvePlaceholder(resolver *koanf.Koanf) *koanf.Koanf {
+ m := make(map[string]interface{})
+ for k, v := range resolver.All() {
+ if _, ok := v.(string); !ok {
Review Comment:
s, ok := v.(string)
if !ok {
continue
}
这样整体少转换一次,是不是?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]