Fix issue in watchdog - not reading false config overrides.

This commit is contained in:
Alex Ellis
2017-04-05 09:06:47 +01:00
committed by Alex Ellis
parent 93bdfba4b2
commit 469fc690da
9 changed files with 80 additions and 16 deletions

View File

@ -18,7 +18,7 @@ func parseBoolValue(val string) bool {
if val == "true" {
return true
}
return true
return false
}
func parseIntValue(val string) int {
@ -55,11 +55,15 @@ func (ReadConfig) Read(hasEnv HasEnv) WatchdogConfig {
cfg.readTimeout = time.Duration(readTimeout) * time.Second
cfg.writeTimeout = time.Duration(writeTimeout) * time.Second
cfg.writeDebug = parseBoolValue(hasEnv.Getenv("write_debug"))
if len(hasEnv.Getenv("write_debug")) > 0 {
cfg.writeDebug = parseBoolValue(hasEnv.Getenv("write_debug"))
}
cfg.marshalRequest = parseBoolValue(hasEnv.Getenv("marshal_request"))
cfg.debugHeaders = parseBoolValue(hasEnv.Getenv("debug_headers"))
cfg.suppressLock = parseBoolValue(hasEnv.Getenv("suppress_lock"))
return cfg
}