Skip to content

Commit

Permalink
Fix: ProviderConfig.Filter and ReferenceConfig.Filter not work
Browse files Browse the repository at this point in the history
  • Loading branch information
ray2011 committed Jun 3, 2022
1 parent 0935a8e commit 026711b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config/reference_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (rc *ReferenceConfig) Init(root *RootConfig) error {
rc.Version = root.Application.Version
}
}
if rc.Filter == "" {
rc.Filter = root.Consumer.Filter
}
if rc.Cluster == "" {
rc.Cluster = "failover"
}
Expand Down Expand Up @@ -309,7 +312,7 @@ func (rc *ReferenceConfig) getURLMap() url.Values {
if rc.Generic != "" {
defaultReferenceFilter = constant.GenericFilterKey + "," + defaultReferenceFilter
}
urlMap.Set(constant.ReferenceFilterKey, mergeValue(rc.rootConfig.Consumer.Filter, "", defaultReferenceFilter))
urlMap.Set(constant.ReferenceFilterKey, mergeValue(rc.Filter, "", defaultReferenceFilter))

for _, v := range rc.Methods {
urlMap.Set("methods."+v.Name+"."+constant.LoadbalanceKey, v.LoadBalance)
Expand Down
3 changes: 3 additions & 0 deletions config/service_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func (s *ServiceConfig) Init(rc *RootConfig) error {
}
s.exported = atomic.NewBool(false)
s.metadataType = rc.Application.MetadataType
if s.Filter == "" {
s.Filter = rc.Provider.Filter
}
if s.Version == "" {
s.Version = rc.Application.Version
}
Expand Down

0 comments on commit 026711b

Please sign in to comment.