Document how server.mjs keeps the site up when an API is misconfigured and reports it on /api/health, the cache and CSP policy, the share API's synchronous reservation, the trust placed in X-Forwarded-For, the hooks main.jsx wires once, and how to run each script. The deploy script header now recalls that CI runs the copy installed on the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.6 KiB
JavaScript
29 lines
1.6 KiB
JavaScript
/**
|
|
* @file Sauvegarde, vérifie ou restaure la base de Sokko TCG, pour les tâches d'exploitation.
|
|
*
|
|
* Usage : node scripts/backup-nebula-cards.mjs backup <base> <copie> | scheduled <base> <dossier> [--keep <n>]
|
|
* | verify <copie> | restore <copie> <base>. Le mode `scheduled` est lancé chaque nuit par
|
|
* ops/systemd/sokko-g-cards-backup.timer.
|
|
* @see docs/DELIVERY.md
|
|
*/
|
|
|
|
import { resolve } from "node:path";
|
|
import { backupCardsDatabase, restoreCardsDatabase, runScheduledBackup, verifyCardsDatabase } from "../services/cards/backup.js";
|
|
|
|
const [mode, source, destination, keepFlag, keepValue] = process.argv.slice(2);
|
|
if (mode === "backup" && source && destination) {
|
|
await backupCardsDatabase(resolve(source), resolve(destination));
|
|
console.log(`Sokko TCG backup written to ${resolve(destination)}`);
|
|
} else if (mode === "scheduled" && source && destination && (!keepFlag || keepFlag === "--keep")) {
|
|
const written = await runScheduledBackup(resolve(source), resolve(destination), keepFlag ? { keep: Number(keepValue) } : {});
|
|
console.log(`Sokko TCG scheduled backup written to ${written}`);
|
|
} else if (mode === "verify" && source) {
|
|
verifyCardsDatabase(resolve(source));
|
|
console.log(`Sokko TCG backup verified: ${resolve(source)}`);
|
|
} else if (mode === "restore" && source && destination) {
|
|
restoreCardsDatabase(resolve(source), resolve(destination));
|
|
console.log(`Sokko TCG database restored to ${resolve(destination)}`);
|
|
} else {
|
|
console.error("Usage: node scripts/backup-nebula-cards.mjs backup <database> <backup> | scheduled <database> <directory> [--keep <count>] | verify <backup> | restore <backup> <database>");
|
|
process.exitCode = 1;
|
|
}
|