From 5451899e485b695dbb1c048e34d971010f0d87e8 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Thu, 29 Jun 2023 14:13:23 +0200 Subject: [PATCH] Consul refactor --- consul/discovery.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/consul/discovery.go b/consul/discovery.go index 64767c8..29a9e02 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -19,8 +19,8 @@ type Service struct { port int ttl time.Duration agent *consul.Agent + connect *consul.Connect kv *consul.KV - catalog *consul.Catalog } var ErrServiceUnavailable = fmt.Errorf("Service is unavailable") @@ -40,8 +40,8 @@ func NewService(servAddr, id, name, hostname, domain, pathPrefix string, appPort return nil, err } s.agent = client.Agent() + s.connect = client.Connect() s.kv = client.KV() - s.catalog = client.Catalog() return s, nil } @@ -103,12 +103,12 @@ func (s *Service) Unregister() error { return s.agent.ServiceDeregister(s.GetID()) } -func (s *Service) KV() *consul.KV { - return s.kv +func (s *Service) Connect() *consul.Connect { + return s.connect } -func (s *Service) Catalog() *consul.Catalog { - return s.catalog +func (s *Service) KV() *consul.KV { + return s.kv } func (s *Service) healthCheck() (bool, error) {