ctwatch: allow state dir to be set by $CTWATCH_STATE_DIR

This commit is contained in:
Andrew Ayer 2016-03-08 07:09:26 -08:00
parent f988d05b4b
commit 5ccf9fdcd3
1 changed files with 9 additions and 1 deletions

View File

@ -12,7 +12,15 @@ import (
"src.agwa.name/ctwatch/cmd"
)
var stateDir = flag.String("state_dir", cmd.DefaultStateDir("ctwatch"), "Directory for storing state")
func DefaultStateDir () string {
if envVar := os.Getenv("CTWATCH_STATE_DIR"); envVar != "" {
return envVar
} else {
return cmd.DefaultStateDir("ctwatch")
}
}
var stateDir = flag.String("state_dir", DefaultStateDir(), "Directory for storing state")
var watchDomains []string
var watchDomainSuffixes []string