diff --git a/migrations/1757326540_settings.go b/migrations/1757326540_settings.go index 380ccc41e..71f535e62 100644 --- a/migrations/1757326540_settings.go +++ b/migrations/1757326540_settings.go @@ -17,7 +17,24 @@ func init() { } settings.Meta.AppName = "Primo CMS" - app.Save(settings) + + // Enable automatic backups by default so a fresh deploy isn't one + // volume wipe away from total data loss. Stored on the pb_data + // volume (backups/ dir) — a floor, not off-site protection; wire up + // Backups.S3 for that. Env-overridable; only set when unconfigured + // so we never clobber a schedule set via the admin UI. + if settings.Backups.Cron == "" { + cron := os.Getenv("PRIMO_BACKUP_CRON") + if cron == "" { + cron = "0 3 * * *" // daily at 03:00 + } + settings.Backups.Cron = cron + settings.Backups.CronMaxKeep = 7 + } + + if err := app.Save(settings); err != nil { + return err + } superuserEmail := os.Getenv("PRIMO_SUPERUSER_EMAIL") superuserPassword := os.Getenv("PRIMO_SUPERUSER_PASSWORD")