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

+4
View File
@@ -12,6 +12,7 @@ require (
github.com/oschwald/maxminddb-golang/v2 v2.7.0
github.com/prometheus/client_golang v1.24.1
github.com/spf13/viper v1.21.0
go.uber.org/fx v1.24.0
golang.org/x/sys v0.48.0
)
@@ -44,6 +45,9 @@ require (
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/valllabh/ocsf-schema-golang v1.0.3 // indirect
go.uber.org/dig v1.19.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.26.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/net v0.60.0 // indirect