add validate config for raft (#4332)

This commit is contained in:
Konstantin Lebedev 2023-03-21 18:36:13 +05:00 committed by GitHub
parent 5c783c16a1
commit de4545c28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,6 +121,10 @@ func NewHashicorpRaftServer(option *RaftServerOption) (*RaftServer, error) {
c.LogLevel = "Error"
}
if err := raft.ValidateConfig(c); err != nil {
return nil, fmt.Errorf(`raft.ValidateConfig: %v`, err)
}
if option.RaftBootstrap {
os.RemoveAll(path.Join(s.dataDir, ldbFile))
os.RemoveAll(path.Join(s.dataDir, sdbFile))