From a687572769257087deb8f62b3f13b8d156ed8a46 Mon Sep 17 00:00:00 2001 From: Sebastien Pouplin Date: Tue, 14 Nov 2023 08:31:22 +0700 Subject: [PATCH] Fix Consul Loader panic from #272 --- pkg/loaders/consul_loader/consul_loader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/loaders/consul_loader/consul_loader.go b/pkg/loaders/consul_loader/consul_loader.go index fe813ec2..caa16b73 100644 --- a/pkg/loaders/consul_loader/consul_loader.go +++ b/pkg/loaders/consul_loader/consul_loader.go @@ -377,7 +377,7 @@ func (c *consulLoader) serviceEntryToTargetConfig(se *api.ServiceEntry) (*types. SRV: for _, sd := range c.cfg.Services { // match service name - if se.Service.Service == sd.Name { + if se.Service.Service != sd.Name { continue } @@ -407,7 +407,7 @@ SRV: return tc, nil } - return nil, nil + return nil, errors.New("unable to find a match in Consul service(s)") } func (c *consulLoader) updateTargets(ctx context.Context, srvName string, tcs map[string]*types.TargetConfig, opChan chan *loaders.TargetOperation) {