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:
@@ -57,10 +57,16 @@ type MatrixConfig struct {
|
||||
}
|
||||
|
||||
type PostingConfig struct {
|
||||
MinIntervalSeconds int `toml:"min_interval_seconds"`
|
||||
BurstCapCount int `toml:"burst_cap_count"`
|
||||
BurstCapWindowSeconds int `toml:"burst_cap_window_seconds"`
|
||||
DedupCooldownHours int `toml:"dedup_cooldown_hours"`
|
||||
// Enabled is the master switch for automatic news posting to Matrix.
|
||||
// When false, stories are still ingested, classified, and served to the
|
||||
// web UI, but Pete never auto-posts them to rooms. Command replies
|
||||
// (!post, !petestats) still work. Pointer so an absent key defaults to
|
||||
// true (posting on) rather than Go's zero-value false.
|
||||
Enabled *bool `toml:"enabled"`
|
||||
MinIntervalSeconds int `toml:"min_interval_seconds"`
|
||||
BurstCapCount int `toml:"burst_cap_count"`
|
||||
BurstCapWindowSeconds int `toml:"burst_cap_window_seconds"`
|
||||
DedupCooldownHours int `toml:"dedup_cooldown_hours"`
|
||||
// DailyCapTotal is the hard global cap on posts across ALL channels in a
|
||||
// rolling 24-hour window. 0 disables the cap.
|
||||
DailyCapTotal int `toml:"daily_cap_total"`
|
||||
@@ -198,6 +204,10 @@ func (c *Config) applyDefaults() {
|
||||
if c.Matrix.DisplayName == "" {
|
||||
c.Matrix.DisplayName = "Pete"
|
||||
}
|
||||
if c.Posting.Enabled == nil {
|
||||
on := true
|
||||
c.Posting.Enabled = &on
|
||||
}
|
||||
if c.Posting.MinIntervalSeconds == 0 {
|
||||
c.Posting.MinIntervalSeconds = 300
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user