Skip to content

Commit

Permalink
Merge pull request #49 from r0p0s3c/issue-12-support-additional-backends
Browse files Browse the repository at this point in the history
Fix up use of addr in service registration
  • Loading branch information
magiconair committed Feb 9, 2016
2 parents 345b6a7 + 1430385 commit 6e6f632
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions registry/consul/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ func serviceRegistration(addr, name string, interval, timeout time.Duration) (*a
return nil, err
}

ip, err := config.LocalIP()
if err != nil {
return nil, err
}
ip := net.ParseIP(ipstr)

if ip == nil {
givenip := net.ParseIP(ipstr)
if givenip == nil {
return nil, errors.New("no local ip")
}
ip = givenip
ip, err := config.LocalIP()

if err != nil {
return nil, err
}
if ip == nil {
return nil, errors.New("no local ip")
}
}

serviceID := fmt.Sprintf("%s-%s-%d", name, hostname, port)
Expand Down

0 comments on commit 6e6f632

Please sign in to comment.