mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-12 23:54:01 +09:00
fix(observability-proxy): reject negative timeouts at startup
A negative duration silently disables the bound it configures, so a typo in the chart would turn off the request deadline or the tail idle close without any sign. Refuse it when the flags are parsed. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
159f90691e
commit
1c345da367
2 files changed
+5
No files matched your search
@@ -102,6 +102,8 @@ func parseFlags(args []string) (options, error) {
|
||||
return o, errors.New("--logs-default-limit must be positive and not above --logs-max-limit")
|
||||
case o.logs.MaxTailResume < 0:
|
||||
return o, errors.New("--logs-max-tail-resume must not be negative")
|
||||
case o.requestTimeout < 0 || o.tailIdleTimeout < 0 || o.authCacheTTL < 0 || o.shutdownTimeout < 0:
|
||||
return o, errors.New("timeouts and the auth cache TTL must not be negative")
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ func TestParseFlagsInvalid(t *testing.T) {
|
||||
{"--logs-default-limit=0"},
|
||||
{"--logs-default-limit=100", "--logs-max-limit=10"},
|
||||
{"--logs-max-tail-resume=-1m"},
|
||||
{"--request-timeout=-1s"},
|
||||
{"--tail-idle-timeout=-1s"},
|
||||
{"--auth-cache-ttl=-1s"},
|
||||
{"--unknown"},
|
||||
} {
|
||||
if _, err := parseFlags(args); err == nil {
|
||||
|
||||
Reference in new issue
Block a user