feat(backup): take Tinyforge DB snapshot before every deploy
Adds an opt-in "auto_backup_before_deploy" setting that triggers a "pre-deploy" backup at the start of every project deploy via the deploy pipeline (covers both the async HTTP path and the sync poller/webhook path). Failures are logged to the deploy log but do not abort — missing a backup is preferable to refusing to ship a fix. - store: settings.auto_backup_before_deploy column + scan/update wiring - backup: accept "pre-deploy" as a valid backup_type - deployer: small PreDeployBackuper interface, hooked into runDeploy right after settings load and before any state-mutating work - api: settings request/response surface the new flag - web: ToggleSwitch on the backup settings page; "Pre-deploy" badge variant in the backup list (badge-warning so it stands out) - i18n: en/ru strings for the toggle, help text, and badge label
This commit is contained in:
@@ -42,7 +42,7 @@ func (e *Engine) BackupDir() string {
|
||||
func (e *Engine) CreateBackup(backupType string) (store.Backup, error) {
|
||||
// Validate backup type to prevent path traversal via filename.
|
||||
switch backupType {
|
||||
case "manual", "auto", "pre-restore":
|
||||
case "manual", "auto", "pre-restore", "pre-deploy":
|
||||
// valid
|
||||
default:
|
||||
return store.Backup{}, fmt.Errorf("invalid backup type: %q", backupType)
|
||||
|
||||
Reference in New Issue
Block a user