Skip to content

Commit

Permalink
Fix to adhere enable persistence flag when passed as program args (#1320
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lucifercr07 authored Nov 22, 2024
1 parent 61b8b1d commit 12676ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func MergeFlags(flags *Config) {
DiceConfig.Logging.LogLevel = flags.Logging.LogLevel
case "log-dir":
DiceConfig.Logging.LogDir = flags.Logging.LogDir
case "persistence-enable":
case "enable-persistence":
DiceConfig.Persistence.Enabled = flags.Persistence.Enabled
case "restore-from-wal":
DiceConfig.Persistence.RestoreFromWAL = flags.Persistence.RestoreFromWAL
Expand Down
1 change: 0 additions & 1 deletion integration_tests/config/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ type persistence struct {
AOFFile string `config:"aof_file" default:"./dice-master.aof" validate:"filepath"`
PersistenceEnabled bool `config:"persistence_enabled" default:"true"`
WriteAOFOnCleanup bool `config:"write_aof_on_cleanup" default:"false"`
EnableWAL bool `config:"enable-wal" default:"false"`
WALDir string `config:"wal-dir" default:"./" validate:"dirpath"`
RestoreFromWAL bool `config:"restore-wal" default:"false"`
WALEngine string `config:"wal-engine" default:"aof" validate:"oneof=sqlite aof"`
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func Execute() {
flag.StringVar(&flagsConfig.Logging.LogLevel, "log-level", "info", "log level, values: info, debug")
flag.StringVar(&config.DiceConfig.Logging.LogDir, "log-dir", "/tmp/dicedb", "log directory path")

flag.BoolVar(&flagsConfig.Persistence.Enabled, "persistence-enable", false, "enable write-ahead logging")
flag.BoolVar(&flagsConfig.Persistence.Enabled, "enable-persistence", false, "enable write-ahead logging")
flag.BoolVar(&flagsConfig.Persistence.RestoreFromWAL, "restore-wal", false, "restore the database from the WAL files")
flag.StringVar(&flagsConfig.Persistence.WALEngine, "wal-engine", "null", "wal engine to use, values: sqlite, aof")

Expand Down Expand Up @@ -124,7 +124,7 @@ func Execute() {
fmt.Println(" -enable-profiling Enable profiling and capture critical metrics and traces in .prof files (default: false)")
fmt.Println(" -log-level Log level, values: info, debug (default: \"info\")")
fmt.Println(" -log-dir Log directory path (default: \"/tmp/dicedb\")")
fmt.Println(" -enable-wal Enable write-ahead logging (default: false)")
fmt.Println(" -enable-persistence Enable write-ahead logging (default: false)")
fmt.Println(" -restore-wal Restore the database from the WAL files (default: false)")
fmt.Println(" -wal-engine WAL engine to use, values: sqlite, aof (default: \"null\")")
fmt.Println(" -requirepass Enable authentication for the default user (default: \"\")")
Expand Down

0 comments on commit 12676ee

Please sign in to comment.