support services without version
This commit is contained in:
parent
e8b050ffd5
commit
982e6068cf
@ -211,18 +211,18 @@ func (c *consulRegistry) GetService(name string) ([]*Service, error) {
|
||||
}
|
||||
|
||||
// version is now a tag
|
||||
version, found := decodeVersion(s.Service.Tags)
|
||||
version, _ := decodeVersion(s.Service.Tags)
|
||||
// service ID is now the node id
|
||||
id := s.Service.ID
|
||||
// key is always the version
|
||||
key := version
|
||||
|
||||
// address is service address
|
||||
address := s.Service.Address
|
||||
|
||||
// if we can't get the version we bail
|
||||
// use old the old ways
|
||||
if !found {
|
||||
continue
|
||||
// use node address
|
||||
if len(address) == 0 {
|
||||
address = s.Node.Address
|
||||
}
|
||||
|
||||
svc, ok := serviceMap[key]
|
||||
@ -236,6 +236,7 @@ func (c *consulRegistry) GetService(name string) ([]*Service, error) {
|
||||
}
|
||||
|
||||
var del bool
|
||||
|
||||
for _, check := range s.Checks {
|
||||
// delete the node if the status is critical
|
||||
if check.Status == "critical" {
|
||||
|
@ -60,7 +60,7 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
|
||||
for _, e := range entries {
|
||||
serviceName = e.Service.Service
|
||||
// version is now a tag
|
||||
version, found := decodeVersion(e.Service.Tags)
|
||||
version, _ := decodeVersion(e.Service.Tags)
|
||||
// service ID is now the node id
|
||||
id := e.Service.ID
|
||||
// key is always the version
|
||||
@ -68,9 +68,9 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
|
||||
// address is service address
|
||||
address := e.Service.Address
|
||||
|
||||
// if we can't get the version we bail
|
||||
if !found {
|
||||
continue
|
||||
// use node address
|
||||
if len(address) == 0 {
|
||||
address = e.Node.Address
|
||||
}
|
||||
|
||||
svc, ok := serviceMap[key]
|
||||
|
Loading…
Reference in New Issue
Block a user