extract an ip that can be advertised in embedded nats

This commit is contained in:
Asim Aslam 2020-01-18 15:39:26 +00:00
parent 058fd8adbf
commit bdf1d20f4e

View File

@ -120,7 +120,13 @@ func (n *natsBroker) serve(exit chan bool) error {
// with no address we just default it // with no address we just default it
// this is a local client address // this is a local client address
if len(n.addrs) == 0 { if len(n.addrs) == 0 {
// find an advertiseable ip
if h, err := addr.Extract(""); err != nil {
host = "127.0.0.1" host = "127.0.0.1"
} else {
host = h
}
port = -1 port = -1
local = true local = true
} else { } else {