File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ import { cookies } from 'next/headers';
66
77import { db } from '@/db' ;
88import { users } from '@/db/schema/users' ;
9+ import { readServerEnv } from '@/lib/env/server-env' ;
910
1011const AUTH_COOKIE_NAME = 'auth_session' ;
1112const AUTH_TOKEN_MAX_AGE = 60 * 60 * 24 * 7 ; // 7 days
1213
13- const _AUTH_SECRET = process . env . AUTH_SECRET ;
14+ const _AUTH_SECRET = readServerEnv ( ' AUTH_SECRET' ) ;
1415
1516if ( ! _AUTH_SECRET ) {
1617 throw new Error ( 'AUTH_SECRET is not defined' ) ;
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ import crypto from 'node:crypto';
44
55import type { NextRequest } from 'next/server' ;
66
7+ import { readServerEnv } from '@/lib/env/server-env' ;
8+
79export const CSRF_FORM_FIELD = 'csrfToken' as const ;
810
911const DEFAULT_TTL_SECONDS = 60 * 60 ;
1012function getSecret ( ) : string {
11- const secret = process . env . CSRF_SECRET ;
13+ const secret = readServerEnv ( ' CSRF_SECRET' ) ;
1214 if ( ! secret ) throw new Error ( 'Missing env var: CSRF_SECRET' ) ;
1315 return secret ;
1416}
You can’t perform that action at this time.
0 commit comments