Add posting.enabled master switch to disable auto-posting to Matrix

Stories are still ingested, classified, and served to the web UI; only
automatic Matrix posting is gated. Command replies (!post, !petestats)
still work. Pointer-bool so an absent key defaults to posting-on.
This commit is contained in:
prosolis
2026-06-24 16:39:59 -07:00
parent e65ffb1373
commit 410f8dda0a
3 changed files with 26 additions and 5 deletions

12
main.go
View File

@@ -174,7 +174,11 @@ func main() {
go queue.Start(ctx)
slog.Info("post queue started")
postingEnabled := *cfg.Posting.Enabled
roundRobinMode := cfg.Posting.RoundRobin.Enabled
if !postingEnabled {
slog.Info("automatic Matrix posting is disabled (posting.enabled=false); stories will still be ingested and served to the web UI, and !post still works")
}
// Pipeline callback: route the story to its direct_route channel, then
// either enqueue immediately or leave it for the round-robin scheduler.
@@ -188,6 +192,12 @@ func main() {
channel := item.DirectRoute
storage.MarkClassified(item.GUID, channel, "[]")
// Posting disabled: classify and keep for the web UI / manual !post,
// but never auto-enqueue to Matrix.
if !postingEnabled {
return
}
if roundRobinMode {
slog.Info("story routed, awaiting round-robin tick",
"guid", item.GUID, "source", item.Source, "channel", channel)
@@ -215,7 +225,7 @@ func main() {
poller.Start(ctx)
slog.Info("pollers started")
if roundRobinMode {
if postingEnabled && roundRobinMode {
channelNames := make([]string, 0, len(cfg.Matrix.Channels))
for name := range cfg.Matrix.Channels {
channelNames = append(channelNames, name)