Skip to content

Commit

Permalink
Add listenAddress support in raft address agent option
Browse files Browse the repository at this point in the history
  • Loading branch information
kevburnsjr committed Jan 4, 2025
1 parent a9d6db0 commit 4781a6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion agent_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ func WithGossipAddress(advertiseAddress string, bindAddress ...string) AgentOpti
}
}

func WithRaftAddress(raftAddress string) AgentOption {
func WithRaftAddress(raftAddress string, listenAddress ...string) AgentOption {
return func(a *Agent) error {
a.hostConfig.RaftAddress = raftAddress
if len(listenAddress) > 0 {
a.hostConfig.ListenAddress = listenAddress[0]
} else {
a.hostConfig.ListenAddress = fmt.Sprintf("0.0.0.0:%s", strings.Split(raftAddress, ":")[1])
}
return nil
}
}
Expand Down

0 comments on commit 4781a6c

Please sign in to comment.