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 {