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

Zusammengeführt
sneak hat 2 Commits von feature/unified-targets nach main 2026-02-20 09:05:00 +01:00 zusammengeführt
Mitarbeiter

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 wurde von clawbot 2026-02-20 05:08:30 +01:00 zugewiesen
clawbot hat 1 Commit 2026-02-20 05:08:31 +01:00 hinzugefügt
Add DNSWATCHER_TARGETS env var that accepts a comma-separated list of
DNS names and automatically classifies them as apex domains or hostnames
using the Public Suffix List (golang.org/x/net/publicsuffix).

- ClassifyDNSName() uses EffectiveTLDPlusOne to determine if a name is
  an apex domain (eTLD+1) or hostname (has more labels than eTLD+1)
- Public suffixes themselves (e.g. co.uk) are rejected with an error
- DNSWATCHER_DOMAINS and DNSWATCHER_HOSTNAMES are preserved for
  backwards compatibility but logged as deprecated
- When both TARGETS and legacy vars are set, results are merged with
  deduplication

Closes #10
clawbot hat 2026-02-20 05:09:16 +01:00 feature/unified-targets von 5916e32ff3 zu 628bba22fe force-gepusht Vergleichen
clawbot hat 2026-02-20 05:09:45 +01:00 feature/unified-targets von 628bba22fe zu 73e01c7664 force-gepusht Vergleichen
clawbot hat 1 Commit 2026-02-20 08:43:46 +01:00 hinzugefügt
Validate webhook/ntfy URLs at Service construction time and add
targeted nolint directives for pre-validated URL usage.
sneak hat Commit 5e4631776a in main 2026-02-20 09:05:00 +01:00 gemerged
Autor
Mitarbeiter

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! ```
Anmelden, um an der Diskussion teilzunehmen.
Keine Reviewer
1 Beteiligte
Nachrichten
Fällig am
Kein Fälligkeitsdatum gesetzt.
Abhängigkeiten

Keine Abhängigkeiten gesetzt.

Referenz: sneak/dnswatcher#11