Skip to content

Commit

Permalink
load join address from file
Browse files Browse the repository at this point in the history
  • Loading branch information
tdx committed Aug 29, 2020
1 parent 73e0c87 commit 346505f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/discovery/membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ func (m *Membership) setupSerf() (err error) {
}
m.logger = logger

if len(m.StartJoinAddrs) == 0 {
if len(m.StartJoinAddrs) < 2 {
if v := m.persist.GetJoins(); v != "" {

m.StartJoinAddrs = strings.Split(v, ",")
joinAddrs := strings.Split(v, ",")
if len(joinAddrs) > len(m.StartJoinAddrs) {
m.StartJoinAddrs = joinAddrs
}
}
}

Expand Down Expand Up @@ -191,7 +193,7 @@ func normaliseAddr(addr string) (string, error) {
switch host {
case "::":
host = "ip6-localhost"
case ":":
case "", ":":
host = "localhost"
}
return net.JoinHostPort(host, port), nil
Expand Down

0 comments on commit 346505f

Please sign in to comment.