Skip to content

Commit

Permalink
fix: set compatible default storage path on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyzimmer committed Aug 2, 2023
1 parent 03c5ee8 commit 2eade14
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/raft/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"flag"
"io"
"path/filepath"
"runtime"
"time"

"github.com/hashicorp/go-hclog"
Expand Down Expand Up @@ -107,8 +108,13 @@ type Options struct {
// NewOptions returns new raft options with the default values.
func NewOptions() *Options {
return &Options{
ListenAddress: ":9443",
DataDir: "/var/lib/webmesh/store",
ListenAddress: ":9443",
DataDir: func() string {
if runtime.GOOS == "windows" {
return "C:\\ProgramData\\webmesh\\store"
}
return "/var/lib/webmesh/store"
}(),
ConnectionTimeout: time.Second * 3,
HeartbeatTimeout: time.Second * 3,
ElectionTimeout: time.Second * 3,
Expand Down

0 comments on commit 2eade14

Please sign in to comment.