Mulavar commented on a change in pull request #1565:
URL: https://github.com/apache/dubbo-go/pull/1565#discussion_r744632865



##########
File path: registry/nacos/service_discovery.go
##########
@@ -330,22 +328,21 @@ func (n *nacosServiceDiscovery) String() string {
 }
 
 // newNacosServiceDiscovery will create new service discovery instance
-func newNacosServiceDiscovery() (registry.ServiceDiscovery, error) {
-       metadataReportConfig := config.GetMetadataReportConfg()
-       url := common.NewURLWithOptions(
-               common.WithParams(make(url.Values)),
-               common.WithPassword(metadataReportConfig.Password),
-               common.WithUsername(metadataReportConfig.Username),
-               common.WithParamsValue(constant.RegistryTimeoutKey, 
metadataReportConfig.Timeout))
-       url.Location = metadataReportConfig.Address
-       client, err := nacos.NewNacosClientByUrl(url)
+func newNacosServiceDiscovery(url *common.URL) (registry.ServiceDiscovery, 
error) {
+       discoveryUrl := common.NewURLWithOptions(
+               common.WithParams(url.GetParams()),
+               common.WithParamsValue(constant.NacosUsername, url.Username),
+               common.WithParamsValue(constant.NacosPassword, url.Password),
+               common.WithParamsValue(constant.NacosNamespaceID, 
url.GetParam(constant.NamespaceKey, "")))

Review comment:
       还有一个问题,假如用户没设置 namespace,在 config_center_config.go 里,给这个字段设置了一个默认值 
dubbo,所以 url.GetParam(constant.NamespaceKey, "") 这个代码应该永远不会返回 "",需要改一下 
namespace 在 config_center_config.go 的默认值。




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