From 9e19a8cace8790a5982e68b68dad83876f9790a6 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Fri, 29 May 2026 11:02:52 +0200 Subject: [PATCH] chore(backup): disable scheduled backups --- .github/workflows/backup.yml | 29 ----------------------------- api/backup.js | 11 ++++++++++- 2 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/backup.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml deleted file mode 100644 index 5f62aa4..0000000 --- a/.github/workflows/backup.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Supabase Backup to Dropbox - -on: - schedule: - - cron: '0 0,6,12,18 * * *' # every 6h at 00:00, 06:00, 12:00, 18:00 UTC - workflow_dispatch: # allow manual trigger from GitHub UI - -jobs: - backup: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Trigger backup endpoint - run: | - RESPONSE=$(curl -s -w "\n%{http_code}" \ - -X GET \ - -H "Authorization: Bearer ${{ secrets.BACKUP_SECRET }}" \ - https://craze-data-check.vercel.app/api/backup) - - HTTP_STATUS=$(echo "$RESPONSE" | tail -n1) - BODY=$(echo "$RESPONSE" | head -n-1) - - echo "Status: $HTTP_STATUS" - echo "Response: $BODY" - - if [ "$HTTP_STATUS" != "200" ]; then - echo "Backup failed with status $HTTP_STATUS" - exit 1 - fi diff --git a/api/backup.js b/api/backup.js index 7b7cb08..8327fc4 100644 --- a/api/backup.js +++ b/api/backup.js @@ -5,6 +5,7 @@ const DROPBOX_APP_KEY = process.env.DROPBOX_APP_KEY; const DROPBOX_APP_SECRET = process.env.DROPBOX_APP_SECRET; const DROPBOX_REFRESH_TOKEN = process.env.DROPBOX_REFRESH_TOKEN; const BACKUP_SECRET = process.env.BACKUP_SECRET; +const BACKUP_CRON_ENABLED = process.env.BACKUP_CRON_ENABLED === 'true'; const DROPBOX_BACKUP_FOLDER = '/CrazeBackups'; const MAX_BACKUP_AGE_DAYS = 7; @@ -87,7 +88,15 @@ async function deleteOldBackups(token) { } export default async function handler(req, res) { - // Allow cron (no origin) or requests with valid secret + // Backup cron disabled by default to prevent noisy scheduled failures. + if (!BACKUP_CRON_ENABLED) { + return res.status(200).json({ + success: true, + skipped: true, + reason: 'backup cron disabled', + }); + } + const authHeader = req.headers['authorization']; const isCron = !req.headers.origin; const hasSecret = BACKUP_SECRET && authHeader === `Bearer ${BACKUP_SECRET}`;