consul: Only add ourself to the peerset if we are in bootstrap mode

This commit is contained in:
Armon Dadgar 2014-02-20 16:27:14 -08:00
parent 421c4d6933
commit 5d8783148b
1 changed files with 10 additions and 8 deletions

View File

@ -220,7 +220,8 @@ func (s *Server) setupRaft() error {
// Setup the peer store
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()
if err != nil {
store.Close()
@ -229,6 +230,7 @@ func (s *Server) setupRaft() error {
if !raft.PeerContained(peers, trans.LocalAddr()) {
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
}
}
// Make sure we set the LogOutput
s.config.RaftConfig.LogOutput = s.config.LogOutput