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:
parent
9ba211d2fc
commit
fbeb3bf9f6
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue