feat: unify DOMAINS/HOSTNAMES into single TARGETS config (closes #10) #11

Merged
sneak merged 2 commits from feature/unified-targets into main 2026-02-20 09:05:00 +01:00
Collaborator

Summary

Replaces DNSWATCHER_DOMAINS and DNSWATCHER_HOSTNAMES with a single DNSWATCHER_TARGETS env var. Names are automatically classified as apex domains or hostnames using the Public Suffix List (golang.org/x/net/publicsuffix). No backwards compatibility — old vars are removed entirely (pre-1.0).

Changes

  • internal/config/classify.go: ClassifyDNSName() and ClassifyTargets() using publicsuffix.EffectiveTLDPlusOne()
  • internal/config/classify_test.go: 11 test cases
  • internal/config/config.go: Replaced DOMAINS/HOSTNAMES with TARGETS, removed all legacy/deprecation logic
  • README.md: Added pre-1.0 warning, updated env var table, removed old vars

Classification

Input Result
example.com domain
www.example.com hostname
example.co.uk domain
api.example.co.uk hostname
co.uk error (public suffix)

Test Results

All 12 tests pass. No new lint issues (only pre-existing gosec in notify.go). Build succeeds.

Closes #10

## Summary Replaces `DNSWATCHER_DOMAINS` and `DNSWATCHER_HOSTNAMES` with a single `DNSWATCHER_TARGETS` env var. Names are automatically classified as apex domains or hostnames using the Public Suffix List (`golang.org/x/net/publicsuffix`). No backwards compatibility — old vars are removed entirely (pre-1.0). ## Changes - **`internal/config/classify.go`**: `ClassifyDNSName()` and `ClassifyTargets()` using `publicsuffix.EffectiveTLDPlusOne()` - **`internal/config/classify_test.go`**: 11 test cases - **`internal/config/config.go`**: Replaced DOMAINS/HOSTNAMES with TARGETS, removed all legacy/deprecation logic - **`README.md`**: Added pre-1.0 warning, updated env var table, removed old vars ## Classification | Input | Result | |-------|--------| | `example.com` | domain | | `www.example.com` | hostname | | `example.co.uk` | domain | | `api.example.co.uk` | hostname | | `co.uk` | error (public suffix) | ## Test Results All 12 tests pass. No new lint issues (only pre-existing gosec in notify.go). Build succeeds. Closes #10
sneak was assigned by clawbot 2026-02-20 05:08:30 +01:00
clawbot force-pushed feature/unified-targets from 5916e32ff3 to 628bba22fe 2026-02-20 05:09:16 +01:00 Compare
clawbot force-pushed feature/unified-targets from 628bba22fe to 73e01c7664 2026-02-20 05:09:45 +01:00 Compare
clawbot added 1 commit 2026-02-20 08:43:46 +01:00
Validate webhook/ntfy URLs at Service construction time and add
targeted nolint directives for pre-validated URL usage.
sneak merged commit 5e4631776a into main 2026-02-20 09:05:00 +01:00
Author
Collaborator

make check passes ✅

==> Checking formatting...
==> Running linter...
==> Running tests...
PASS ok sneak.berlin/go/dnswatcher/internal/config 1.280s
==> Building...
==> All checks passed!
make check passes ✅ ``` ==> Checking formatting... ==> Running linter... ==> Running tests... PASS ok sneak.berlin/go/dnswatcher/internal/config 1.280s ==> Building... ==> All checks passed! ```
Sign in to join this conversation.