When DNSWATCHER_TARGETS is empty or unset (the default), dnswatcher now exits with a clear error message instead of silently starting with nothing to monitor.
Changes
Added ErrNoTargets sentinel error in internal/config/config.go
buildConfig now validates that at least one domain or hostname is configured after target classification
When no targets are configured, config.New returns ErrNoTargets, causing the fx application to fail to start with a clear error message
Extracted classifyAndValidateTargets() and parseDurationOrDefault() helpers to keep buildConfig within the funlen limit
Added tests: TestNewReturnsErrNoTargetsWhenEmpty and TestNewSucceedsWithTargets
When `DNSWATCHER_TARGETS` is empty or unset (the default), dnswatcher now exits with a clear error message instead of silently starting with nothing to monitor.
## Changes
- Added `ErrNoTargets` sentinel error in `internal/config/config.go`
- `buildConfig` now validates that at least one domain or hostname is configured after target classification
- When no targets are configured, `config.New` returns `ErrNoTargets`, causing the fx application to fail to start with a clear error message
- Extracted `classifyAndValidateTargets()` and `parseDurationOrDefault()` helpers to keep `buildConfig` within the funlen limit
- Added tests: `TestNewReturnsErrNoTargetsWhenEmpty` and `TestNewSucceedsWithTargets`
Closes #69
When DNSWATCHER_TARGETS is empty or unset (the default), dnswatcher now
exits with a clear error message instead of silently starting with
nothing to monitor.
Added ErrNoTargets sentinel error returned from config.New when both
domains and hostnames lists are empty after target classification. This
causes the fx application to fail to start, preventing silent
misconfiguration.
Also extracted classifyAndValidateTargets and parseDurationOrDefault
helper functions to keep buildConfig within the funlen limit.
Closes#69
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.
When
DNSWATCHER_TARGETSis empty or unset (the default), dnswatcher now exits with a clear error message instead of silently starting with nothing to monitor.Changes
ErrNoTargetssentinel error ininternal/config/config.gobuildConfignow validates that at least one domain or hostname is configured after target classificationconfig.NewreturnsErrNoTargets, causing the fx application to fail to start with a clear error messageclassifyAndValidateTargets()andparseDurationOrDefault()helpers to keepbuildConfigwithin the funlen limitTestNewReturnsErrNoTargetsWhenEmptyandTestNewSucceedsWithTargetsCloses #69
Closing as duplicate — PR #75 already addresses issue #69 and is merge-ready.
Pull request closed