Add advertise-address #4

Merged
killian merged 3 commits from advertise-address into master 2022-02-11 16:13:32 +01:00
1 changed files with 3 additions and 2 deletions
Showing only changes of commit 42f993b96d - Show all commits

View File

@ -6,6 +6,7 @@ import (
"github.com/costela/wesher/cluster"
"github.com/hashicorp/go-sockaddr"
"github.com/mikioh/ipaddr"
"github.com/pkg/errors"
"github.com/stevenroose/gonfig"
)
@ -81,8 +82,8 @@ func loadConfig() (*config, error) {
}
}
if config.AdvertiseAddr == "" {
config.AdvertiseAddr = config.BindAddr
if _, err := ipaddr.Parse(config.AdvertiseAddr); err != nil {
config.AdvertiseAddr = ""
}
return &config, nil