refactor: 30-day defaults, time-based message expiry
All checks were successful
check / check (push) Successful in 5s

- Change QUEUE_MAX_AGE default from 48h to 30 days (2592000s)
- Replace count-based MAX_HISTORY with time-based MESSAGE_MAX_AGE
  (default 30 days) — messages older than the configured age are
  pruned instead of keeping a fixed count per target
- Update README to reflect new defaults and time-based expiry
This commit is contained in:
clawbot
2026-03-10 03:47:33 -07:00
parent 5f05b70be7
commit d9dbadaf62
4 changed files with 35 additions and 93 deletions

View File

@@ -38,7 +38,7 @@ type Config struct {
MetricsUsername string
Port int
SentryDSN string
MaxHistory int
MessageMaxAge int
MaxMessageSize int
QueueMaxAge int
MOTD string
@@ -69,9 +69,9 @@ func New(
viper.SetDefault("SENTRY_DSN", "")
viper.SetDefault("METRICS_USERNAME", "")
viper.SetDefault("METRICS_PASSWORD", "")
viper.SetDefault("MAX_HISTORY", "10000")
viper.SetDefault("MESSAGE_MAX_AGE", "2592000")
viper.SetDefault("MAX_MESSAGE_SIZE", "4096")
viper.SetDefault("QUEUE_MAX_AGE", "172800")
viper.SetDefault("QUEUE_MAX_AGE", "2592000")
viper.SetDefault("MOTD", defaultMOTD)
viper.SetDefault("SERVER_NAME", "")
viper.SetDefault("FEDERATION_KEY", "")
@@ -94,7 +94,7 @@ func New(
MaintenanceMode: viper.GetBool("MAINTENANCE_MODE"),
MetricsUsername: viper.GetString("METRICS_USERNAME"),
MetricsPassword: viper.GetString("METRICS_PASSWORD"),
MaxHistory: viper.GetInt("MAX_HISTORY"),
MessageMaxAge: viper.GetInt("MESSAGE_MAX_AGE"),
MaxMessageSize: viper.GetInt("MAX_MESSAGE_SIZE"),
QueueMaxAge: viper.GetInt("QUEUE_MAX_AGE"),
MOTD: viper.GetString("MOTD"),