PORT and DNSWATCHER_TLS_EXPIRY_WARNING were read with viper.GetInt, and DNSWATCHER_DEBUG, DNSWATCHER_MAINTENANCE_MODE and DNSWATCHER_SEND_TEST_NOTIFICATION with viper.GetBool. Both turn a value that does not parse into 0 or false with no error, so PORT=notaport listened on a random port and DNSWATCHER_TLS_EXPIRY_WARNING=abc meant no expiry warning was ever sent.
Each is now read as a string and parsed the way parseInterval parses an interval, with an error of the same form (invalid PORT "notaport": port must be a whole number from 1 to 65535):
PORT: a whole number from 1 to 65535.
DNSWATCHER_TLS_EXPIRY_WARNING: a whole number of days, 1 or more.
The three true/false settings: a value strconv.ParseBool accepts.
Unset or empty still means the default. The README's Configuration section gets a paragraph saying this, after the one on the intervals.
Deviation: reading the config file moved, unchanged, from buildConfig into a new readConfigFile; with five more checks buildConfig would go over the linter's 80-line function limit.
Judgement call: TestNew_EmptyIntervalMeansDefault is renamed TestNew_EmptyValueMeansDefault and now covers the five settings as well.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/dnswatcher/issues/269.
`PORT` and `DNSWATCHER_TLS_EXPIRY_WARNING` were read with `viper.GetInt`, and `DNSWATCHER_DEBUG`, `DNSWATCHER_MAINTENANCE_MODE` and `DNSWATCHER_SEND_TEST_NOTIFICATION` with `viper.GetBool`. Both turn a value that does not parse into 0 or false with no error, so `PORT=notaport` listened on a random port and `DNSWATCHER_TLS_EXPIRY_WARNING=abc` meant no expiry warning was ever sent.
Each is now read as a string and parsed the way `parseInterval` parses an interval, with an error of the same form (`invalid PORT "notaport": port must be a whole number from 1 to 65535`):
- `PORT`: a whole number from 1 to 65535.
- `DNSWATCHER_TLS_EXPIRY_WARNING`: a whole number of days, 1 or more.
- The three true/false settings: a value `strconv.ParseBool` accepts.
Unset or empty still means the default. The README's Configuration section gets a paragraph saying this, after the one on the intervals.
Deviation: reading the config file moved, unchanged, from `buildConfig` into a new `readConfigFile`; with five more checks `buildConfig` would go over the linter's 80-line function limit.
Judgement call: `TestNew_EmptyIntervalMeansDefault` is renamed `TestNew_EmptyValueMeansDefault` and now covers the five settings as well.
Model: opus-5-5
PORT and DNSWATCHER_TLS_EXPIRY_WARNING were read with viper.GetInt,
and DNSWATCHER_DEBUG, DNSWATCHER_MAINTENANCE_MODE and
DNSWATCHER_SEND_TEST_NOTIFICATION with viper.GetBool, which turn a
value that does not parse into 0 or false with no error. Each is now
parsed the way parseInterval parses an interval: PORT must be 1 to
65535, the expiry warning 1 or more days, the true/false settings a
value strconv.ParseBool accepts. Anything else stops startup with an
error naming the variable and the value; empty still means the
default.
Reading the config file moved, unchanged, from buildConfig into
readConfigFile, so buildConfig stays within the linter's length limit.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #269.
PORTandDNSWATCHER_TLS_EXPIRY_WARNINGwere read withviper.GetInt, andDNSWATCHER_DEBUG,DNSWATCHER_MAINTENANCE_MODEandDNSWATCHER_SEND_TEST_NOTIFICATIONwithviper.GetBool. Both turn a value that does not parse into 0 or false with no error, soPORT=notaportlistened on a random port andDNSWATCHER_TLS_EXPIRY_WARNING=abcmeant no expiry warning was ever sent.Each is now read as a string and parsed the way
parseIntervalparses an interval, with an error of the same form (invalid PORT "notaport": port must be a whole number from 1 to 65535):PORT: a whole number from 1 to 65535.DNSWATCHER_TLS_EXPIRY_WARNING: a whole number of days, 1 or more.strconv.ParseBoolaccepts.Unset or empty still means the default. The README's Configuration section gets a paragraph saying this, after the one on the intervals.
Deviation: reading the config file moved, unchanged, from
buildConfiginto a newreadConfigFile; with five more checksbuildConfigwould go over the linter's 80-line function limit.Judgement call:
TestNew_EmptyIntervalMeansDefaultis renamedTestNew_EmptyValueMeansDefaultand now covers the five settings as well.Model: opus-5-5
Review: PASS
Model: opus-5-5