Skip to content

Commit

Permalink
PR #49: If the supplied addr has a host-ip part, use that, otherwise …
Browse files Browse the repository at this point in the history
…fallback to local ip detection
  • Loading branch information
r0p0s3c authored and magiconair committed Feb 9, 2016
1 parent 7280a78 commit 4c002cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [Issue #43](https://github.com/eBay/fabio/issues/43): Allow configuration via env vars
* [Issue #47](https://github.com/eBay/fabio/issues/47): Move dependencies to vendor path
* [Issue #48](https://github.com/eBay/fabio/issues/48): Allow configuration of serviceip used during consul registration
* [PR #49](https://github.com/eBay/fabio/pull/49): Fix up use of addr in service registration

### [v1.0.8](https://github.com/eBay/fabio/releases/tag/v1.0.8) - 14 Jan 2015

Expand Down
13 changes: 6 additions & 7 deletions registry/consul/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ 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 {
ip, err := config.LocalIP()
if err != nil {
return nil, err
}
if ip == nil {
return nil, errors.New("no local ip")
}
ip = givenip
}

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

0 comments on commit 4c002cc

Please sign in to comment.