INNER CODE UNIT · TypeScript
assertJwtSecretConfigured
colyseus/colyseus · packages/admin/src-backend/index.ts:238
function assertJwtSecretConfigured(): void {
const secret = (JWT as any).settings?.secret || process.env.JWT_SECRET;
if (secret) { return; }
if (process.env.NODE_ENV === 'production') {
throw new Error(
'[admin] JWT_SECRET is required in production — admin sessions ' +
'cannot be signed without it. Set the JWT_SECRET environment variable or ' +
'assign JWT.settings.secret before calling admin().',
);
}
if (!jwtWarnedOnce) {
jwtWarnedOnce = true;
// eslint-disable-next-line no-console
console.warn(
'[admin] No JWT secret configured. Admin sessions will fail to ' +
'sign. Set JWT_SECRET (env) or JWT.settings.secret before deploying.',