Config: Remove legacy config fields again (#3782)

* Remove more lecacy fields

* Patch missing bracket

* Fix tests

* Fix missing comma

* Fix buried test bomb

* Cleanup test after removed legacy test content
This commit is contained in:
Kobe Arthur Scofield 2024-09-11 22:37:25 +08:00 committed by GitHub
parent c90affe7db
commit 6b1bf312d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 152 deletions

View file

@ -14,11 +14,6 @@ import (
"google.golang.org/protobuf/proto"
)
type RouterRulesConfig struct {
RuleList []json.RawMessage `json:"rules"`
DomainStrategy string `json:"domainStrategy"`
}
// StrategyConfig represents a strategy config
type StrategyConfig struct {
Type string `json:"type"`
@ -76,7 +71,6 @@ func (r *BalancingRule) Build() (*router.BalancingRule, error) {
}
type RouterConfig struct {
Settings *RouterRulesConfig `json:"settings"` // Deprecated
RuleList []json.RawMessage `json:"rules"`
DomainStrategy *string `json:"domainStrategy"`
Balancers []*BalancingRule `json:"balancers"`
@ -88,8 +82,6 @@ func (c *RouterConfig) getDomainStrategy() router.Config_DomainStrategy {
ds := ""
if c.DomainStrategy != nil {
ds = *c.DomainStrategy
} else if c.Settings != nil {
ds = c.Settings.DomainStrategy
}
switch strings.ToLower(ds) {
@ -111,10 +103,6 @@ func (c *RouterConfig) Build() (*router.Config, error) {
var rawRuleList []json.RawMessage
if c != nil {
rawRuleList = c.RuleList
if c.Settings != nil {
c.RuleList = append(c.RuleList, c.Settings.RuleList...)
rawRuleList = c.RuleList
}
}
for _, rawRule := range rawRuleList {