Skip to content

Commit

Permalink
[Add] Support for using the Host Address
Browse files Browse the repository at this point in the history
This adds support for using the Host Address as the Address of Record for the service if the service.Address is not defined.
  • Loading branch information
TechIsCool authored and yyyar committed Aug 12, 2018
1 parent a95a7a8 commit a596f89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/discovery/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,16 @@ func consulFetch(cfg config.DiscoveryConfig) (*[]core.Backend, error) {
sni = split[1]
}

var host string
if s.Address != "" {
host = s.Address
} else {
host = entry.Node.Address
}

backends = append(backends, core.Backend{
Target: core.Target{
Host: s.Address,
Host: host,
Port: fmt.Sprintf("%v", s.Port),
},
Priority: 1,
Expand Down

0 comments on commit a596f89

Please sign in to comment.