fix(scripts): read the server's .env in the admin reset and the key rotation

Both scripts now load server/.env as the server does, so an install whose TREK_DB_URL lives there resets the admin and rotates the key in its Postgres database instead of in a SQLite file left behind by the move.
This commit is contained in:
Maurice
2026-11-23 15:02:04 +01:00
parent de1c3b8ea6
commit 52a6fbbc92
3 changed files with 48 additions and 0 deletions
+3
View File
@@ -21,6 +21,9 @@ const path = require('path');
const crypto = require('crypto');
const bcrypt = require('bcryptjs');
// The server reads its .env too (src/index.ts), so TREK_DB_URL kept there picks the same database here.
require('dotenv').config({ path: path.join(__dirname, '.env'), quiet: true });
// Kept in sync with the seeder/authService cost factor.
const BCRYPT_COST = 12;