An invalid DNSWATCHER_DNS_INTERVAL or DNSWATCHER_TLS_INTERVAL is silently replaced by the default #177

Closed
opened 2026-10-01 21:00:00 +02:00 by clawbot · 1 comment
Collaborator

Found while reviewing #167.

internal/config/config.go parses DNSWATCHER_DNS_INTERVAL and DNSWATCHER_TLS_INTERVAL with time.ParseDuration and, when that fails, uses the default (1 hour, 12 hours) without logging anything. An operator who writes DNSWATCHER_DNS_INTERVAL=5 or =1d gets hourly checks and no hint why. A zero or negative value parses and is accepted. Elsewhere config errors already stop startup (malformed config file, invalid targets).

Definition of done

  • An interval that does not parse, or is zero or negative, stops startup with an error naming the variable and the value given.
  • An unset variable still means the default.
  • Tests in internal/config cover a bad value, a non-positive value and an unset one for each of the two variables.
  • README: the environment variable table says what a valid value looks like and that an invalid one stops startup.
  • DNS is never mocked; nothing here touches DNS.

Model: opus-5-5

Found while reviewing https://git.eeqj.de/sneak/dnswatcher/pulls/167. `internal/config/config.go` parses `DNSWATCHER_DNS_INTERVAL` and `DNSWATCHER_TLS_INTERVAL` with `time.ParseDuration` and, when that fails, uses the default (1 hour, 12 hours) without logging anything. An operator who writes `DNSWATCHER_DNS_INTERVAL=5` or `=1d` gets hourly checks and no hint why. A zero or negative value parses and is accepted. Elsewhere config errors already stop startup (malformed config file, invalid targets). ## Definition of done - An interval that does not parse, or is zero or negative, stops startup with an error naming the variable and the value given. - An unset variable still means the default. - Tests in `internal/config` cover a bad value, a non-positive value and an unset one for each of the two variables. - README: the environment variable table says what a valid value looks like and that an invalid one stops startup. - DNS is never mocked; nothing here touches DNS. Model: opus-5-5
clawbot added this to the 1.0 milestone 2026-10-01 21:00:00 +02:00
Author
Collaborator

Implemented in #178: an interval that does not parse, or is zero or negative, now stops startup with an error naming the variable and the value; unset still means the default. Note for operators: a deployment that currently sets something like 1d and silently runs on the default will refuse to start once this lands.

Model: opus-5-5

Implemented in https://git.eeqj.de/sneak/dnswatcher/pulls/178: an interval that does not parse, or is zero or negative, now stops startup with an error naming the variable and the value; unset still means the default. Note for operators: a deployment that currently sets something like `1d` and silently runs on the default will refuse to start once this lands. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/dnswatcher#177