Added the advertise http option to the client
This commit is contained in:
parent
e83130934d
commit
69a17e2a29
|
@ -224,7 +224,18 @@ func (a *Agent) setupClient() error {
|
|||
conf.Node.NodeClass = a.config.Client.NodeClass
|
||||
httpAddr := a.config.BindAddr
|
||||
if a.config.Addresses.HTTP != "" {
|
||||
httpAddr = a.config.Addresses.HTTP
|
||||
addr, err := net.ResolveTCPAddr("tcp", a.config.Addresses.HTTP)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error resolving http addr: %v:", err)
|
||||
}
|
||||
httpAddr = fmt.Sprintf("%s:%d", addr.IP.String(), addr.Port)
|
||||
}
|
||||
if a.config.AdvertiseAddrs.HTTP != "" {
|
||||
addr, err := net.ResolveTCPAddr("tcp", a.config.AdvertiseAddrs.HTTP)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error resolving advertise http addr: %v", err)
|
||||
}
|
||||
httpAddr = fmt.Sprintf("%s:%d", addr.IP.String(), addr.Port)
|
||||
}
|
||||
conf.Node.HTTPAddr = fmt.Sprintf("%s:%d", httpAddr, a.config.Ports.HTTP)
|
||||
|
||||
|
|
|
@ -243,6 +243,7 @@ type Addresses struct {
|
|||
// different network services. Not all network services support an
|
||||
// advertise address. All are optional and default to BindAddr.
|
||||
type AdvertiseAddrs struct {
|
||||
HTTP string `hcl:"http"`
|
||||
RPC string `hcl:"rpc"`
|
||||
Serf string `hcl:"serf"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue