LaurenceLiZhixin commented on a change in pull request #1565: URL: https://github.com/apache/dubbo-go/pull/1565#discussion_r746224209
########## 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, ""))) + discoveryUrl.Location = url.Location + client, err := nacos.NewNacosClientByUrl(discoveryUrl) Review comment: Fixed ########## 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, ""))) + discoveryUrl.Location = url.Location + client, err := nacos.NewNacosClientByUrl(discoveryUrl) if err != nil { return nil, perrors.WithMessage(err, "create nacos namingClient failed.") } - descriptor := fmt.Sprintf("nacos-service-discovery[%s]", metadataReportConfig.Address) + descriptor := fmt.Sprintf("nacos-service-discovery[%s]", discoveryUrl.Location) Review comment: Fixed -- 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: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org