From 566cbbd31b90682b270994eeabd19fdebae9a317 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Thu, 29 Jun 2023 14:34:25 +0200 Subject: [PATCH] Consul refactor --- consul/discovery.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/consul/discovery.go b/consul/discovery.go index 21d4508..14bc1e1 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -21,7 +21,7 @@ type Service struct { ttl time.Duration client *consul.Client agent *consul.Agent - connect *consul.Connect + connect *connect.Service kv *consul.KV } @@ -107,7 +107,10 @@ func (s *Service) Unregister() error { } func (s *Service) Connect() (*connect.Service, error) { - return connect.NewService(s.Name, s.client) + svc, err := connect.NewService(s.Name, s.client) + s.connect = svc + + return svc, err } func (s *Service) KV() *consul.KV {