Skip to content

Commit

Permalink
error on process.env outside config
Browse files Browse the repository at this point in the history
  • Loading branch information
wheelsandcogs committed Sep 27, 2024
1 parent 2a1470b commit 287297c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default [
{
rules: {
'line-comment-position': 'off',
'no-process-env': 'warn',
'no-warning-comments': 'warn',
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/naming-convention': [
Expand Down
5 changes: 4 additions & 1 deletion test/helpers/auth-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import jwt from 'jsonwebtoken';

import { User } from '../../src/entities/user';
import { sanitiseUser } from '../../src/utils/sanitise-user';
import { appConfig } from '../../src/config';

const config = appConfig();

export const getAuthHeader = (user: User) => {
const payload = { user: sanitiseUser(user) };
const token = jwt.sign(payload, process.env.JWT_SECRET!);
const token = jwt.sign(payload, config.auth.jwt.secret);
return { Authorization: `Bearer ${token}` };
};

0 comments on commit 287297c

Please sign in to comment.