Data safety (2026-11-13 incident: a deploy read a half-written rotator.json, the store fell back to empty and its next save wiped 294 spin links): safefs.js makes every .json write inside DATA_DIR atomic (temp file + rename); LinkSpin's rotator refuses to start empty when rotator.json exists but will not parse

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-13 09:11:27 -06:00
parent 656c9a940d
commit d1c9d62801
3 changed files with 39 additions and 1 deletions
+1
View File
@@ -100,6 +100,7 @@ const PORT = Number(process.env.PORT || 3000);
const ROOT = __dirname;
const PUBLIC_DIR = path.join(ROOT, 'public');
const DATA_DIR = process.env.DATA_DIR || path.join(ROOT, 'data');
require('./safefs').install(DATA_DIR); // every .json data file is written atomically (2026-11-13 rotator.json loss)
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || 'changeme';
const ADMIN_EMAIL = String(process.env.ADMIN_EMAIL || '').trim().toLowerCase();
const { SITE_HOST, SITE_URL } = require('./host');