From fbeb3bf9f6909372e51c2eb2e4efa0c8f98e6f64 Mon Sep 17 00:00:00 2001 From: postmannen Date: Thu, 10 Feb 2022 06:19:13 +0100 Subject: [PATCH] added flag purgeBufferDB --- configuration_flags.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configuration_flags.go b/configuration_flags.go index cbca797..5c03f49 100644 --- a/configuration_flags.go +++ b/configuration_flags.go @@ -546,6 +546,8 @@ func (c *Configuration) CheckFlags() error { flag.BoolVar(&c.StartSubREQCliCommandCont, "startSubREQCliCommandCont", fc.StartSubREQCliCommandCont, "true/false") flag.BoolVar(&c.StartSubREQRelay, "startSubREQRelay", fc.StartSubREQRelay, "true/false") + purgeBufferDB := flag.Bool("purgeBufferDB", false, "true/false, purge the incoming buffer db and all it's state") + flag.Parse() // Check that mandatory flag values have been set. @@ -561,6 +563,15 @@ func (c *Configuration) CheckFlags() error { os.Exit(1) } + if *purgeBufferDB { + fp := filepath.Join(c.DatabaseFolder, "incomingBuffer.db") + err := os.Remove(fp) + if err != nil { + log.Printf("error: failed to purge buffer state database: %v\n", err) + } + + } + return nil }