feat(server): healthz, testable app, local dev script (P0-3)
This commit is contained in:
@@ -6,7 +6,11 @@ const bcrypt = require('bcryptjs');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const { Users, Wallet, Tokens } = require('./db');
|
||||
|
||||
const SECRET = process.env.JWT_SECRET || 'dev-insecure-change-me';
|
||||
// No secret configured -> random per process (tokens die on restart). Never fall back to a known string.
|
||||
const SECRET = process.env.JWT_SECRET || (() => {
|
||||
if (process.env.NODE_ENV !== 'test') console.warn('[auth] JWT_SECRET not set - using a random secret, sessions end on restart');
|
||||
return crypto.randomBytes(32).toString('hex');
|
||||
})();
|
||||
const ACCESS_TTL = 3600; // seconds
|
||||
const REFRESH_TTL = 30 * 864e5; // 30 days (ms)
|
||||
const START_MONEY = 800;
|
||||
|
||||
Reference in New Issue
Block a user