Skip to content

Commit

Permalink
Fixing logs and adding restore snapshot flag
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpert committed Oct 10, 2022
1 parent a4352b2 commit acb1a29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"github.com/nats-io/nats.go"
)

var Cleanup = flag.Bool("cleanup", false, "Cleanup all trigger hooks for marmot")
var Cleanup = flag.Bool("cleanup", false, "Only cleanup marmot triggers and changelogs")
var SaveSnapshot = flag.Bool("save-snapshot", false, "Only take snapshot and upload")
var RestoreSnapshot = flag.Bool("restore-snapshot", true, "Restore snapshot at boot")
var DBPathString = flag.String("db-path", "/tmp/marmot.db", "Path to SQLite database")
var NodeID = flag.Uint64("node-id", rand.Uint64(), "Node ID")
var NatsAddr = flag.String("nats-url", nats.DefaultURL, "NATS server URL")
Expand Down
8 changes: 5 additions & 3 deletions marmot.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ func main() {
return
}

err = rep.RestoreSnapshot()
if err != nil {
log.Panic().Err(err).Msg("Unable to restore snapshot")
if *cfg.RestoreSnapshot {
err = rep.RestoreSnapshot()
if err != nil {
log.Panic().Err(err).Msg("Unable to restore snapshot")
}
}

log.Info().Msg("Listing tables to watch...")
Expand Down

0 comments on commit acb1a29

Please sign in to comment.