From 1adfc2720a17222110201754058dc8a48b80b2f1 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Thu, 16 Sep 2021 16:07:35 -0400 Subject: [PATCH] Allow bulk definition of domain matcher at parent level (#713) Co-authored-by: Shelikhoo --- infra/conf/router.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infra/conf/router.go b/infra/conf/router.go index abed22c6..ed0b488c 100644 --- a/infra/conf/router.go +++ b/infra/conf/router.go @@ -42,6 +42,8 @@ type RouterConfig struct { RuleList []json.RawMessage `json:"rules"` DomainStrategy *string `json:"domainStrategy"` Balancers []*BalancingRule `json:"balancers"` + + DomainMatcher string `json:"domainMatcher"` } func (c *RouterConfig) getDomainStrategy() router.Config_DomainStrategy { @@ -82,6 +84,11 @@ func (c *RouterConfig) Build() (*router.Config, error) { if err != nil { return nil, err } + + if rule.DomainMatcher == "" { + rule.DomainMatcher = c.DomainMatcher + } + config.Rule = append(config.Rule, rule) } for _, rawBalancer := range c.Balancers {