mirror of https://github.com/status-im/consul.git
consul: Only add ourself to the peerset if we are in bootstrap mode
This commit is contained in:
parent
421c4d6933
commit
5d8783148b
|
@ -220,7 +220,8 @@ func (s *Server) setupRaft() error {
|
||||||
// Setup the peer store
|
// Setup the peer store
|
||||||
s.raftPeers = raft.NewJSONPeers(path, trans)
|
s.raftPeers = raft.NewJSONPeers(path, trans)
|
||||||
|
|
||||||
// Ensure local host is always included
|
// Ensure local host is always included if we are in bootstrap mode
|
||||||
|
if s.config.Bootstrap {
|
||||||
peers, err := s.raftPeers.Peers()
|
peers, err := s.raftPeers.Peers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
store.Close()
|
store.Close()
|
||||||
|
@ -229,6 +230,7 @@ func (s *Server) setupRaft() error {
|
||||||
if !raft.PeerContained(peers, trans.LocalAddr()) {
|
if !raft.PeerContained(peers, trans.LocalAddr()) {
|
||||||
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we set the LogOutput
|
// Make sure we set the LogOutput
|
||||||
s.config.RaftConfig.LogOutput = s.config.LogOutput
|
s.config.RaftConfig.LogOutput = s.config.LogOutput
|
||||||
|
|
Loading…
Reference in New Issue