Consul refactor
This commit is contained in:
parent
6dd11c6441
commit
5451899e48
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user