1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

added flag purgeBufferDB

This commit is contained in:
postmannen 2022-02-10 06:19:13 +01:00
parent 9ba211d2fc
commit fbeb3bf9f6

View file

@ -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
}