config: each waf setting's code in one place (closes #449) #479

Merged
clawbot merged 1 commits from issue-449-waf-settings-by-setting into next 2026-11-20 01:44:08 +01:00
Collaborator

Closes #449.

internal/config/waf.go is now ordered by setting, following the settings sections of SPEC as docs/settings.md lists them, Core to Anomaly thresholds. The struct WAF and WAFFromEnvironment stay first. Each setting's reader, parser, errors and check sit together.

Where the diff does not show it:

  • A helper several settings share sits just before the first setting that uses it. Examples: numberNotOff (Core), the duration parsers (State and cache files) and isZone (SWW_WAF_APPS, before the DNSBL zones).
  • checkCountriesAndLookups sits with SWW_WAF_LOOKUP_SOURCE, since it refuses the settings that need lookups while lookups are off.
  • The block of constants (day, ipv4Bits, masked, …) is split in the same way as the error block, each beside its user. The same goes for the DNSBL constants block.
  • Deviation: the only changed lines are var (, const ( and ) around each split block. gofmt also re-aligns the = of some lines in them. git diff --color-moved=plain shows everything else as moved. With whitespace stripped, the old and new files hold the same lines.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/smallwebwaf/issues/449. `internal/config/waf.go` is now ordered by setting, following the settings sections of SPEC as `docs/settings.md` lists them, Core to Anomaly thresholds. The struct `WAF` and `WAFFromEnvironment` stay first. Each setting's reader, parser, errors and check sit together. Where the diff does not show it: - A helper several settings share sits just before the first setting that uses it. Examples: `numberNotOff` (Core), the duration parsers (State and cache files) and `isZone` (`SWW_WAF_APPS`, before the DNSBL zones). - `checkCountriesAndLookups` sits with `SWW_WAF_LOOKUP_SOURCE`, since it refuses the settings that need lookups while lookups are off. - The block of constants (`day`, `ipv4Bits`, `masked`, …) is split in the same way as the error block, each beside its user. The same goes for the DNSBL constants block. - Deviation: the only changed lines are `var (`, `const (` and `)` around each split block. gofmt also re-aligns the `=` of some lines in them. `git diff --color-moved=plain` shows everything else as moved. With whitespace stripped, the old and new files hold the same lines. Model: opus-5-5
clawbot added 1 commit 2026-11-20 01:17:45 +01:00
internal/config/waf.go is reordered by setting, in the order of the
settings sections of SPEC and docs/settings.md. The struct WAF and
WAFFromEnvironment stay first. Each setting's reader, parser, errors
and check sit together. A helper several settings share sits before
the first of them.

Moves only. The one error block and the one block of constants are
split into a block beside each user, so gofmt re-aligns the = of some
of those lines.

Model: opus-5-5
clawbot added the needs-review label 2026-11-20 01:17:46 +01:00
clawbot self-assigned this 2026-11-20 01:17:47 +01:00
Author
Collaborator

Verdict: PASS
Head: 3669abe761

internal/config/waf.go is now ordered by setting in SPEC's section order, and the change only moves code (apart from gofmt re-aligning the split blocks, as the PR says), meeting #449.

Model: opus-5-5

Verdict: PASS Head: 3669abe7614b23f93a5e125fbed87d4b11e0737d `internal/config/waf.go` is now ordered by setting in SPEC's section order, and the change only moves code (apart from gofmt re-aligning the split blocks, as the PR says), meeting https://git.eeqj.de/sneak/smallwebwaf/issues/449. Model: opus-5-5
clawbot merged commit 9afbd1b683 into next 2026-11-20 01:44:08 +01:00
Sign in to join this conversation.