ztelur commented on a change in pull request #171: URL: https://github.com/apache/dubbo-go-pixiu/pull/171#discussion_r650506770
########## File path: pkg/config/api_config.go ########## @@ -67,64 +80,116 @@ func LoadAPIConfigFromFile(path string) (*fc.APIConfig, error) { // LoadAPIConfig load the api config from config center func LoadAPIConfig(metaConfig *model.APIMetaConfig) (*fc.APIConfig, error) { - client = etcdv3.NewConfigClient( + client, _ = etcdv3.NewConfigClientWithErr( etcdv3.WithName(etcdv3.RegistryETCDV3Client), etcdv3.WithTimeout(10*time.Second), etcdv3.WithEndpoints(strings.Split(metaConfig.Address, ",")...), ) - go listenAPIConfigNodeEvent(metaConfig.APIConfigPath) - - content, err := client.Get(metaConfig.APIConfigPath) + kList, vList, err := client.GetChildren(metaConfig.APIConfigPath) if err != nil { return nil, perrors.Errorf("Get remote config fail error %v", err) } - - if err = initAPIConfigFromString(content); err != nil { + if err = initAPIConfigFromKVList(kList, vList); err != nil { return nil, err } + // TODO: 其他需要从远端获取配置的初始化操作 + go listenResourceAndMethodEvent(metaConfig.APIConfigPath) + // TODO: 其他监控配置的操作,比如 PluginGroup 等 return apiConfig, nil } -func initAPIConfigFromString(content string) error { +func initAPIConfigFromKVList(kList, vList []string) error { Review comment: ok, I will make handle resource and handle method two method ########## File path: pkg/config/api_config.go ########## @@ -67,64 +80,116 @@ func LoadAPIConfigFromFile(path string) (*fc.APIConfig, error) { // LoadAPIConfig load the api config from config center func LoadAPIConfig(metaConfig *model.APIMetaConfig) (*fc.APIConfig, error) { - client = etcdv3.NewConfigClient( + client, _ = etcdv3.NewConfigClientWithErr( Review comment: already handle the error return from the new client function -- 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. 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