feat: automate verified SQLite backups and safe recovery

This commit is contained in:
syntaxbullet
2026-09-04 18:28:28 +02:00
parent 32002151e0
commit 661bc6c346
10 changed files with 227 additions and 2 deletions

View File

@@ -1,9 +1,13 @@
import { backupConfig } from "../src/ops/backups";
import { databasePath } from "../src/db/config";
import { fileURLToPath } from "node:url";
// Bun's built HTML assets resolve from dist; keep the database path absolute.
process.env.DATABASE_PATH = databasePath;
process.env.NODE_ENV = "production";
const backups = backupConfig(databasePath);
process.env.BACKUP_DIR = backups.directory;
if (backups.replica) process.env.BACKUP_REPLICA_DIR = backups.replica;
process.chdir(fileURLToPath(new URL("../dist", import.meta.url)));
const entrypoint = new URL("../dist/index.js", import.meta.url).href;
await import(entrypoint);