From 75713b9c71d21c3eecd53bb7fc4eadfb31bfa48a Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Fri, 18 Dec 2020 11:50:58 +0800 Subject: [PATCH 1/8] introduce ConfigPostProcessor extension --- common/extension/config_post_processor.go | 44 +++++++++++++++++++++++ config/config_post_processor.go | 29 +++++++++++++++ config/reference_config.go | 9 +++++ config/service_config.go | 8 +++++ 4 files changed, 90 insertions(+) create mode 100644 common/extension/config_post_processor.go create mode 100644 config/config_post_processor.go diff --git a/common/extension/config_post_processor.go b/common/extension/config_post_processor.go new file mode 100644 index 0000000000..96228c95f2 --- /dev/null +++ b/common/extension/config_post_processor.go @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package extension + +import "github.com/apache/dubbo-go/config" + +var ( + processors = make(map[string]config.ConfigPostProcessor) +) + +// SetConfigPostProcessor registers a ConfigPostProcessor with the given name. +func SetConfigPostProcessor(name string, processor config.ConfigPostProcessor) { + processors[name] = processor +} + +// GetConfigPostProcessor finds a ConfigPostProcessor by name. +func GetConfigPostProcessor(name string) config.ConfigPostProcessor { + return processors[name] +} + +// GetConfigPostProcessors returns all registered instances of ConfigPostProcessor. +func GetConfigPostProcessors() []config.ConfigPostProcessor { + ret := make([]config.ConfigPostProcessor, 0, len(processors)) + for _, v := range processors { + ret = append(ret, v) + } + return ret +} diff --git a/config/config_post_processor.go b/config/config_post_processor.go new file mode 100644 index 0000000000..e4ea3221b5 --- /dev/null +++ b/config/config_post_processor.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package config + +// ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and +// ServiceConfig during deployment time. +type ConfigPostProcessor interface { + // PostProcessReferenceConfig customizes ReferenceConfig + PostProcessReferenceConfig(rc *ReferenceConfig) + + // PostProcessServiceConfig customizes ServiceConfig + PostProcessServiceConfig(sc *ServiceConfig) +} diff --git a/config/reference_config.go b/config/reference_config.go index 05df347736..b92a624624 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -91,6 +91,8 @@ func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error // Refer ... func (c *ReferenceConfig) Refer(_ interface{}) { + c.postProcessConfig() + cfgURL := common.NewURLWithOptions( common.WithPath(c.InterfaceName), common.WithProtocol(c.Protocol), @@ -248,3 +250,10 @@ func (c *ReferenceConfig) GenericLoad(id string) { c.Refer(genericService) c.Implement(genericService) } + +// postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. +func (c *ReferenceConfig) postProcessConfig() { + for _, p := range extension.GetConfigPostProcessors() { + p.PostProcessReferenceConfig(c) + } +} diff --git a/config/service_config.go b/config/service_config.go index 32104f03dd..01f8c3a86a 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -145,6 +145,7 @@ func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List { // Export exports the service func (c *ServiceConfig) Export() error { + c.postProcessConfig() // TODO: config center start here // TODO: delay export @@ -332,3 +333,10 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { } return nil } + +// postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. +func (c *ServiceConfig) postProcessConfig() { + for _, p := range extension.GetConfigPostProcessors() { + p.PostProcessServiceConfig(c) + } +} From 01684bfab14c3f324ab7fc6839e08fd4b360b0fe Mon Sep 17 00:00:00 2001 From: "beiwei.ly" Date: Fri, 18 Dec 2020 13:20:26 +0800 Subject: [PATCH 2/8] correct license header --- common/extension/config_post_processor.go | 1 - config/config_post_processor.go | 1 - 2 files changed, 2 deletions(-) diff --git a/common/extension/config_post_processor.go b/common/extension/config_post_processor.go index 96228c95f2..2f0e525ef7 100644 --- a/common/extension/config_post_processor.go +++ b/common/extension/config_post_processor.go @@ -13,7 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package extension diff --git a/config/config_post_processor.go b/config/config_post_processor.go index e4ea3221b5..994b737fcc 100644 --- a/config/config_post_processor.go +++ b/config/config_post_processor.go @@ -13,7 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package config From 52405be18aa4e6d9cca666409cfccf6f8ba30368 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Fri, 18 Dec 2020 13:40:36 +0800 Subject: [PATCH 3/8] break import cycle --- common/extension/config_post_processor.go | 14 ++++++++------ config/{ => interfaces}/config_post_processor.go | 10 +++++----- config/reference_config.go | 2 +- config/service_config.go | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) rename config/{ => interfaces}/config_post_processor.go (79%) diff --git a/common/extension/config_post_processor.go b/common/extension/config_post_processor.go index 2f0e525ef7..db126b744d 100644 --- a/common/extension/config_post_processor.go +++ b/common/extension/config_post_processor.go @@ -17,25 +17,27 @@ package extension -import "github.com/apache/dubbo-go/config" +import ( + "github.com/apache/dubbo-go/config/interfaces" +) var ( - processors = make(map[string]config.ConfigPostProcessor) + processors = make(map[string]interfaces.ConfigPostProcessor) ) // SetConfigPostProcessor registers a ConfigPostProcessor with the given name. -func SetConfigPostProcessor(name string, processor config.ConfigPostProcessor) { +func SetConfigPostProcessor(name string, processor interfaces.ConfigPostProcessor) { processors[name] = processor } // GetConfigPostProcessor finds a ConfigPostProcessor by name. -func GetConfigPostProcessor(name string) config.ConfigPostProcessor { +func GetConfigPostProcessor(name string) interfaces.ConfigPostProcessor { return processors[name] } // GetConfigPostProcessors returns all registered instances of ConfigPostProcessor. -func GetConfigPostProcessors() []config.ConfigPostProcessor { - ret := make([]config.ConfigPostProcessor, 0, len(processors)) +func GetConfigPostProcessors() []interfaces.ConfigPostProcessor { + ret := make([]interfaces.ConfigPostProcessor, 0, len(processors)) for _, v := range processors { ret = append(ret, v) } diff --git a/config/config_post_processor.go b/config/interfaces/config_post_processor.go similarity index 79% rename from config/config_post_processor.go rename to config/interfaces/config_post_processor.go index 994b737fcc..e678d1cdb2 100644 --- a/config/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -15,14 +15,14 @@ * limitations under the License. */ -package config +package interfaces // ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and // ServiceConfig during deployment time. type ConfigPostProcessor interface { - // PostProcessReferenceConfig customizes ReferenceConfig - PostProcessReferenceConfig(rc *ReferenceConfig) + // PostProcessReferenceConfig customizes ReferenceConfig's params + PostProcessReferenceConfig(params *map[string]string) - // PostProcessServiceConfig customizes ServiceConfig - PostProcessServiceConfig(sc *ServiceConfig) + // PostProcessServiceConfig customizes ServiceConfig's params + PostProcessServiceConfig(params *map[string]string) } diff --git a/config/reference_config.go b/config/reference_config.go index b92a624624..e660890c39 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -254,6 +254,6 @@ func (c *ReferenceConfig) GenericLoad(id string) { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. func (c *ReferenceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessReferenceConfig(c) + p.PostProcessReferenceConfig(&c.Params) } } diff --git a/config/service_config.go b/config/service_config.go index 01f8c3a86a..ec798b1177 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -337,6 +337,6 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. func (c *ServiceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessServiceConfig(c) + p.PostProcessServiceConfig(&c.Params) } } From f7938a301be18fbce199d86b3fb211a2ba8e360b Mon Sep 17 00:00:00 2001 From: "beiwei.ly" Date: Mon, 21 Dec 2020 10:37:22 +0800 Subject: [PATCH 4/8] use map instead of point of map --- config/interfaces/config_post_processor.go | 4 ++-- config/reference_config.go | 2 +- config/service_config.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/interfaces/config_post_processor.go b/config/interfaces/config_post_processor.go index e678d1cdb2..80e10e3d79 100644 --- a/config/interfaces/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -21,8 +21,8 @@ package interfaces // ServiceConfig during deployment time. type ConfigPostProcessor interface { // PostProcessReferenceConfig customizes ReferenceConfig's params - PostProcessReferenceConfig(params *map[string]string) + PostProcessReferenceConfig(params map[string]string) // PostProcessServiceConfig customizes ServiceConfig's params - PostProcessServiceConfig(params *map[string]string) + PostProcessServiceConfig(params map[string]string) } diff --git a/config/reference_config.go b/config/reference_config.go index e660890c39..74e35485e1 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -254,6 +254,6 @@ func (c *ReferenceConfig) GenericLoad(id string) { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. func (c *ReferenceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessReferenceConfig(&c.Params) + p.PostProcessReferenceConfig(c.Params) } } diff --git a/config/service_config.go b/config/service_config.go index ec798b1177..ce1de139cd 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -337,6 +337,6 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. func (c *ServiceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessServiceConfig(&c.Params) + p.PostProcessServiceConfig(c.Params) } } From 78b29c7f20aba9703af15861f544c33d30d0e9bf Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Mon, 21 Dec 2020 12:44:00 +0800 Subject: [PATCH 5/8] use interface{} instead of concrete type --- config/interfaces/config_post_processor.go | 12 ++++++++---- config/reference_config.go | 2 +- config/service_config.go | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/interfaces/config_post_processor.go b/config/interfaces/config_post_processor.go index 80e10e3d79..a5f82fcd5f 100644 --- a/config/interfaces/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -17,12 +17,16 @@ package interfaces +type PostConfigurable interface{} + // ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and // ServiceConfig during deployment time. type ConfigPostProcessor interface { - // PostProcessReferenceConfig customizes ReferenceConfig's params - PostProcessReferenceConfig(params map[string]string) + // PostProcessReferenceConfig customizes ReferenceConfig's params. The 'target' parameter must be a instance of + // ReferenceConfig + PostProcessReferenceConfig(target PostConfigurable) - // PostProcessServiceConfig customizes ServiceConfig's params - PostProcessServiceConfig(params map[string]string) + // PostProcessServiceConfig customizes ServiceConfig's params. The 'target' parameter must be an instance of + // ServiceConfig + PostProcessServiceConfig(target PostConfigurable) } diff --git a/config/reference_config.go b/config/reference_config.go index 74e35485e1..b92a624624 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -254,6 +254,6 @@ func (c *ReferenceConfig) GenericLoad(id string) { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. func (c *ReferenceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessReferenceConfig(c.Params) + p.PostProcessReferenceConfig(c) } } diff --git a/config/service_config.go b/config/service_config.go index ce1de139cd..01f8c3a86a 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -337,6 +337,6 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { // postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. func (c *ServiceConfig) postProcessConfig() { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessServiceConfig(c.Params) + p.PostProcessServiceConfig(c) } } From afab2dcb22a5583c03a108c93bf690ac8b14ceff Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Mon, 21 Dec 2020 12:48:56 +0800 Subject: [PATCH 6/8] enhance comments --- config/interfaces/config_post_processor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/interfaces/config_post_processor.go b/config/interfaces/config_post_processor.go index a5f82fcd5f..18486b4b12 100644 --- a/config/interfaces/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -17,16 +17,17 @@ package interfaces +// PostConfigurable is a marker to indicate the instance can be post-configured. type PostConfigurable interface{} // ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and // ServiceConfig during deployment time. type ConfigPostProcessor interface { // PostProcessReferenceConfig customizes ReferenceConfig's params. The 'target' parameter must be a instance of - // ReferenceConfig + // ReferenceConfig. The implementation must assert the passed in instance is a ReferenceConfig. PostProcessReferenceConfig(target PostConfigurable) // PostProcessServiceConfig customizes ServiceConfig's params. The 'target' parameter must be an instance of - // ServiceConfig + // ServiceConfig. The implementation must assert the passed in instance is a ServiceConfig. PostProcessServiceConfig(target PostConfigurable) } From 8789da2e0c37de5a3b869edcb555dabcc0107b64 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Mon, 21 Dec 2020 13:35:44 +0800 Subject: [PATCH 7/8] use url.Values as parameter, which should be sufficient enough --- config/interfaces/config_post_processor.go | 13 +++++-------- config/reference_config.go | 10 ++++++---- config/service_config.go | 8 +++++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/config/interfaces/config_post_processor.go b/config/interfaces/config_post_processor.go index 18486b4b12..d028e29286 100644 --- a/config/interfaces/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -17,17 +17,14 @@ package interfaces -// PostConfigurable is a marker to indicate the instance can be post-configured. -type PostConfigurable interface{} +import "net/url" // ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and // ServiceConfig during deployment time. type ConfigPostProcessor interface { - // PostProcessReferenceConfig customizes ReferenceConfig's params. The 'target' parameter must be a instance of - // ReferenceConfig. The implementation must assert the passed in instance is a ReferenceConfig. - PostProcessReferenceConfig(target PostConfigurable) + // PostProcessReferenceConfig customizes ReferenceConfig's params. + PostProcessReferenceConfig(url.Values) - // PostProcessServiceConfig customizes ServiceConfig's params. The 'target' parameter must be an instance of - // ServiceConfig. The implementation must assert the passed in instance is a ServiceConfig. - PostProcessServiceConfig(target PostConfigurable) + // PostProcessServiceConfig customizes ServiceConfig's params. + PostProcessServiceConfig(url.Values) } diff --git a/config/reference_config.go b/config/reference_config.go index b92a624624..ea0da54017 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -91,17 +91,19 @@ func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error // Refer ... func (c *ReferenceConfig) Refer(_ interface{}) { - c.postProcessConfig() + urlMap := c.getUrlMap() + c.postProcessConfig(urlMap) cfgURL := common.NewURLWithOptions( common.WithPath(c.InterfaceName), common.WithProtocol(c.Protocol), - common.WithParams(c.getUrlMap()), + common.WithParams(urlMap), common.WithParamsValue(constant.BEAN_NAME_KEY, c.id), ) if c.ForceTag { cfgURL.AddParam(constant.ForceUseTag, "true") } + if c.Url != "" { // 1. user specified URL, could be peer-to-peer address, or register center's address. urlStrings := gxstrings.RegSplit(c.Url, "\\s*[;]+\\s*") @@ -252,8 +254,8 @@ func (c *ReferenceConfig) GenericLoad(id string) { } // postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. -func (c *ReferenceConfig) postProcessConfig() { +func (c *ReferenceConfig) postProcessConfig(values url.Values) { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessReferenceConfig(c) + p.PostProcessReferenceConfig(values) } } diff --git a/config/service_config.go b/config/service_config.go index 01f8c3a86a..987bf0a776 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -145,7 +145,6 @@ func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List { // Export exports the service func (c *ServiceConfig) Export() error { - c.postProcessConfig() // TODO: config center start here // TODO: delay export @@ -160,7 +159,10 @@ func (c *ServiceConfig) Export() error { } regUrls := loadRegistries(c.Registry, providerConfig.Registries, common.PROVIDER) + urlMap := c.getUrlMap() + c.postProcessConfig(urlMap) + protocolConfigs := loadProtocol(c.Protocol, c.Protocols) if len(protocolConfigs) == 0 { logger.Warnf("The service %v's '%v' protocols don't has right protocolConfigs", c.InterfaceName, c.Protocol) @@ -335,8 +337,8 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { } // postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. -func (c *ServiceConfig) postProcessConfig() { +func (c *ServiceConfig) postProcessConfig(values url.Values) { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessServiceConfig(c) + p.PostProcessServiceConfig(values) } } From 95432d1657a3435b86664e5e3b87263fd344427f Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Tue, 22 Dec 2020 10:29:52 +0800 Subject: [PATCH 8/8] use common.URL as parameters --- config/interfaces/config_post_processor.go | 8 +++++--- config/reference_config.go | 11 +++++------ config/service_config.go | 9 ++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/interfaces/config_post_processor.go b/config/interfaces/config_post_processor.go index d028e29286..53dd71780f 100644 --- a/config/interfaces/config_post_processor.go +++ b/config/interfaces/config_post_processor.go @@ -17,14 +17,16 @@ package interfaces -import "net/url" +import ( + "github.com/apache/dubbo-go/common" +) // ConfigPostProcessor is an extension to give users a chance to customize configs against ReferenceConfig and // ServiceConfig during deployment time. type ConfigPostProcessor interface { // PostProcessReferenceConfig customizes ReferenceConfig's params. - PostProcessReferenceConfig(url.Values) + PostProcessReferenceConfig(*common.URL) // PostProcessServiceConfig customizes ServiceConfig's params. - PostProcessServiceConfig(url.Values) + PostProcessServiceConfig(*common.URL) } diff --git a/config/reference_config.go b/config/reference_config.go index ea0da54017..d6096e5d90 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -91,19 +91,18 @@ func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error // Refer ... func (c *ReferenceConfig) Refer(_ interface{}) { - urlMap := c.getUrlMap() - c.postProcessConfig(urlMap) - cfgURL := common.NewURLWithOptions( common.WithPath(c.InterfaceName), common.WithProtocol(c.Protocol), - common.WithParams(urlMap), + common.WithParams(c.getUrlMap()), common.WithParamsValue(constant.BEAN_NAME_KEY, c.id), ) if c.ForceTag { cfgURL.AddParam(constant.ForceUseTag, "true") } + c.postProcessConfig(cfgURL) + if c.Url != "" { // 1. user specified URL, could be peer-to-peer address, or register center's address. urlStrings := gxstrings.RegSplit(c.Url, "\\s*[;]+\\s*") @@ -254,8 +253,8 @@ func (c *ReferenceConfig) GenericLoad(id string) { } // postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig. -func (c *ReferenceConfig) postProcessConfig(values url.Values) { +func (c *ReferenceConfig) postProcessConfig(url *common.URL) { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessReferenceConfig(values) + p.PostProcessReferenceConfig(url) } } diff --git a/config/service_config.go b/config/service_config.go index 987bf0a776..7efbef708f 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -159,10 +159,7 @@ func (c *ServiceConfig) Export() error { } regUrls := loadRegistries(c.Registry, providerConfig.Registries, common.PROVIDER) - urlMap := c.getUrlMap() - c.postProcessConfig(urlMap) - protocolConfigs := loadProtocol(c.Protocol, c.Protocols) if len(protocolConfigs) == 0 { logger.Warnf("The service %v's '%v' protocols don't has right protocolConfigs", c.InterfaceName, c.Protocol) @@ -201,6 +198,8 @@ func (c *ServiceConfig) Export() error { ivkURL.AddParam(constant.Tagkey, c.Tag) } + c.postProcessConfig(ivkURL) + if len(regUrls) > 0 { c.cacheMutex.Lock() if c.cacheProtocol == nil { @@ -337,8 +336,8 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { } // postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig. -func (c *ServiceConfig) postProcessConfig(values url.Values) { +func (c *ServiceConfig) postProcessConfig(url *common.URL) { for _, p := range extension.GetConfigPostProcessors() { - p.PostProcessServiceConfig(values) + p.PostProcessServiceConfig(url) } }