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,14 +220,16 @@ func (s *Server) setupRaft() error {
|
|||
// Setup the peer store
|
||||
s.raftPeers = raft.NewJSONPeers(path, trans)
|
||||
|
||||
// Ensure local host is always included
|
||||
peers, err := s.raftPeers.Peers()
|
||||
if err != nil {
|
||||
store.Close()
|
||||
return err
|
||||
}
|
||||
if !raft.PeerContained(peers, trans.LocalAddr()) {
|
||||
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
||||
// Ensure local host is always included if we are in bootstrap mode
|
||||
if s.config.Bootstrap {
|
||||
peers, err := s.raftPeers.Peers()
|
||||
if err != nil {
|
||||
store.Close()
|
||||
return err
|
||||
}
|
||||
if !raft.PeerContained(peers, trans.LocalAddr()) {
|
||||
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we set the LogOutput
|
||||
|
|
Loading…
Reference in New Issue