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

+2
View File
@@ -750,6 +750,8 @@ stops the running process (see [`docs/state-files.md`](docs/state-files.md)).
- `cmd/sww`: the binary, which only calls `internal/sww`.
- `internal/sww`: the process, as the command it is given, and the health check.
It builds each command's parts with `go.uber.org/fx`, the one package that
imports it.
- `internal/config`: reads the settings, the one place they are read.
- `internal/rproxy`: the reverse proxy in front of one app.
- `internal/waf`: `waf`'s server, which runs the checks and answers its own