Consul refactor

This commit is contained in:
Piotr Biernat 2023-06-29 14:34:25 +02:00
parent 2375c2a23a
commit 566cbbd31b

View File

@ -21,7 +21,7 @@ type Service struct {
ttl time.Duration ttl time.Duration
client *consul.Client client *consul.Client
agent *consul.Agent agent *consul.Agent
connect *consul.Connect connect *connect.Service
kv *consul.KV kv *consul.KV
} }
@ -107,7 +107,10 @@ func (s *Service) Unregister() error {
} }
func (s *Service) Connect() (*connect.Service, 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 { func (s *Service) KV() *consul.KV {