diff --git a/discovery/consul_service_discovery_instance.go b/discovery/consul_service_discovery_instance.go index 4e0859ba..aa35223f 100644 --- a/discovery/consul_service_discovery_instance.go +++ b/discovery/consul_service_discovery_instance.go @@ -18,6 +18,7 @@ package discovery import ( "context" "fmt" + "regexp" "time" "github.com/haproxytech/client-native/v3/configuration" @@ -144,11 +145,16 @@ func (c *consulInstance) updateServices() error { if err != nil { return err } + re := regexp.MustCompile(c.params.Regexp) newIndexes := make(map[string]uint64) for se := range cServices { if se == "consul" { continue } + match := re.MatchString(se) + if !match { + continue + } nodes, meta, err := c.api.Health().Service(se, "", false, &api.QueryOptions{}) if err != nil { continue