sww: wire the daemons with fx (closes #414)
check / check (push) Successful in 4m20s

go.uber.org/fx builds each daemon's parts in internal/sww from one small
provider per part, and runs each background loop as one lifecycle hook.
This replaces newServer, loadStateFiles, the inBackground list and both
serve functions. One serve hook and one run function serve both daemons.

fx's own events go to the process log at debug. Start-up errors keep their
messages through startError. RunWAF and RunRProxy use fx's Start and Stop,
not its signal handling. The last state write is registered before the
loops that feed it, so that it runs after they end.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-19 08:25:06 +00:00
1 parent dadd5768d5
commit 37098fa9b7
7 files changed
+381 -302

No files matched your search

+3 -1
View File
@@ -69,7 +69,9 @@ never as a time.
that command's settings, and runs `internal/rproxy` until `SIGTERM` or
`SIGINT` (see "`rproxy`"). `sww healthcheck` is the image's health check.
With no command, or one it does not know, the binary prints the commands
and exits with status 2.
and exits with status 2. `go.uber.org/fx` builds each command's parts in
this package alone. It starts their background work, and stops it in the
reverse order.
- `internal/config`: reads the settings, the one place they are read.
- `internal/waf`: `waf`'s server. It runs the checks in `check`, and holds
`waf`'s question, answer and report. It answers `waf`'s own endpoints in