Alanxtl commented on code in PR #3401:
URL: https://github.com/apache/dubbo-go/pull/3401#discussion_r3400394386


##########
remoting/getty/getty_client.go:
##########
@@ -63,71 +62,37 @@ func initClient(url *common.URL) {
                return
        }
 
-       // load client config from rootConfig.Protocols
-       // default use dubbo
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ApplicationKey, "") == "" && 
config.GetApplicationConfig() == nil {
-               return
+       // Ensure application config is available via URL attribute
+       commonCfg.EnsureApplicationAttribute(url)
+
+       if url.GetParam(constant.ProtocolKey, "") == "" {
+               if _, ok := url.GetAttribute(constant.ProtocolConfigKey); !ok {
+                       return

Review Comment:
   这里为啥要检查两个key



##########
remoting/getty/getty_server.go:
##########
@@ -55,62 +54,43 @@ func initServer(url *common.URL) {
                return
        }
 
-       // load server config from rootConfig.Protocols
-       // default use dubbo
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ApplicationKey, "") == "" && 
config.GetApplicationConfig() == nil {
-               return
+       // Ensure application config is available via URL attribute
+       commonCfg.EnsureApplicationAttribute(url)
+
+       if url.GetParam(constant.ProtocolKey, "") == "" {
+               if _, ok := url.GetAttribute(constant.ProtocolConfigKey); !ok {
+                       return

Review Comment:
   ditto



##########
remoting/getty/getty_client.go:
##########
@@ -63,71 +62,37 @@ func initClient(url *common.URL) {
                return
        }
 
-       // load client config from rootConfig.Protocols
-       // default use dubbo
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ApplicationKey, "") == "" && 
config.GetApplicationConfig() == nil {
-               return
+       // Ensure application config is available via URL attribute
+       commonCfg.EnsureApplicationAttribute(url)
+
+       if url.GetParam(constant.ProtocolKey, "") == "" {
+               if _, ok := url.GetAttribute(constant.ProtocolConfigKey); !ok {
+                       return
+               }
        }
 
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ProtocolKey, "") == "" && 
config.GetRootConfig().Protocols == nil {
+       protocolConfRaw, ok := url.GetAttribute(constant.ProtocolConfigKey)

Review Comment:
   之前不是放到Param里面的吗 现在用GetAttribute能查到吗



##########
remoting/getty/getty_server.go:
##########
@@ -55,62 +54,43 @@ func initServer(url *common.URL) {
                return
        }
 
-       // load server config from rootConfig.Protocols
-       // default use dubbo
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ApplicationKey, "") == "" && 
config.GetApplicationConfig() == nil {
-               return
+       // Ensure application config is available via URL attribute
+       commonCfg.EnsureApplicationAttribute(url)
+
+       if url.GetParam(constant.ProtocolKey, "") == "" {
+               if _, ok := url.GetAttribute(constant.ProtocolConfigKey); !ok {
+                       return
+               }
        }
 
-       // TODO: Temporary compatibility with old APIs, can be removed later
-       if url.GetParam(constant.ProtocolKey, "") == "" && 
config.GetRootConfig().Protocols == nil {
+       protocolConfRaw, ok := url.GetAttribute(constant.ProtocolConfigKey)

Review Comment:
   ditto



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

Reply via email to