Skip to content

Commit 07defad

Browse files
Merge pull request #1919 from ray2011/master
Fix: ProviderConfig.Filter and ReferenceConfig.Filter not work
2 parents f5da6d3 + 026711b commit 07defad

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

config/reference_config.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ func (rc *ReferenceConfig) Init(root *RootConfig) error {
9696
rc.Version = root.Application.Version
9797
}
9898
}
99+
if rc.Filter == "" {
100+
rc.Filter = root.Consumer.Filter
101+
}
99102
if rc.Cluster == "" {
100103
rc.Cluster = "failover"
101104
}
@@ -309,7 +312,7 @@ func (rc *ReferenceConfig) getURLMap() url.Values {
309312
if rc.Generic != "" {
310313
defaultReferenceFilter = constant.GenericFilterKey + "," + defaultReferenceFilter
311314
}
312-
urlMap.Set(constant.ReferenceFilterKey, mergeValue(rc.rootConfig.Consumer.Filter, "", defaultReferenceFilter))
315+
urlMap.Set(constant.ReferenceFilterKey, mergeValue(rc.Filter, "", defaultReferenceFilter))
313316

314317
for _, v := range rc.Methods {
315318
urlMap.Set("methods."+v.Name+"."+constant.LoadbalanceKey, v.LoadBalance)

config/service_config.go

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func (s *ServiceConfig) Init(rc *RootConfig) error {
109109
}
110110
s.exported = atomic.NewBool(false)
111111
s.metadataType = rc.Application.MetadataType
112+
if s.Filter == "" {
113+
s.Filter = rc.Provider.Filter
114+
}
112115
if s.Version == "" {
113116
s.Version = rc.Application.Version
114117
}

0 commit comments

Comments
 (0)