fix: HIGH+MEDIUM bugs from full audit - listen error, JWT, upload, mailer, webhook
This commit is contained in:
@@ -4,8 +4,13 @@ const { getConfig } = require('../db');
|
||||
function getSecret() {
|
||||
try {
|
||||
const cfg = getConfig();
|
||||
return cfg?.jwt_secret || process.env.JWT_SECRET || 'mc-dev-secret';
|
||||
} catch { return process.env.JWT_SECRET || 'mc-dev-secret'; }
|
||||
const secret = cfg?.jwt_secret || process.env.JWT_SECRET;
|
||||
if (secret) return secret;
|
||||
throw new Error('JWT_SECRET not configured');
|
||||
} catch (e) {
|
||||
if (e.message === 'JWT_SECRET not configured') throw e;
|
||||
return process.env.JWT_SECRET || (() => { throw new Error('JWT_SECRET not configured'); })();
|
||||
}
|
||||
}
|
||||
|
||||
function generateToken(user) {
|
||||
|
||||
Reference in New Issue
Block a user