Using the bindAddr only when user hasn't overrident it

This commit is contained in:
Diptanu Choudhury 2016-01-26 17:08:18 -08:00
parent 26d9554d02
commit e83130934d
1 changed files with 5 additions and 1 deletions

View File

@ -222,7 +222,11 @@ func (a *Agent) setupClient() error {
conf.Node.Name = a.config.NodeName
conf.Node.Meta = a.config.Client.Meta
conf.Node.NodeClass = a.config.Client.NodeClass
conf.Node.HTTPAddr = fmt.Sprintf("%s:%d", a.config.BindAddr, a.config.Ports.HTTP)
httpAddr := a.config.BindAddr
if a.config.Addresses.HTTP != "" {
httpAddr = a.config.Addresses.HTTP
}
conf.Node.HTTPAddr = fmt.Sprintf("%s:%d", httpAddr, a.config.Ports.HTTP)
// Create the client
client, err := client.NewClient(conf)