You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/05/26 08:27:58 UTC

[GitHub] [dubbo-go-pixiu] ztelur commented on a change in pull request #171: make Pixiu Admin config management finer-grained

ztelur commented on a change in pull request #171:
URL: https://github.com/apache/dubbo-go-pixiu/pull/171#discussion_r639510936



##########
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:
       resource and method data store in etcd as parent path relation. with this design, it' a little difficulty to split this function when fetch data from etcd use prefix=true option 




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org