1
1
// Disable the following rule because this file is the intended place to declare
2
2
// and load all env variables.
3
- /* eslint-disable n/no-process-env, @typescript-eslint/no-non-null-assertion, turbo/no-undeclared-env-vars */
3
+ /* eslint-disable n/no-process-env */
4
4
5
5
import { Redis } from 'ioredis' ;
6
6
import "server-only" ;
@@ -63,10 +63,7 @@ export const ENABLE_ACCESSIBILITY_REPORTING =
63
63
let redisClient : Redis | undefined ;
64
64
65
65
export function getRedis ( ) : Redis {
66
- const url = process . env . REDIS_URL ;
67
- if ( ! url ) {
68
- throw new Error ( 'REDIS_URL must be set' ) ;
69
- }
66
+ const url = demand ( "REDIS_URL" ) ;
70
67
if ( redisClient ) {
71
68
return redisClient ;
72
69
}
@@ -76,13 +73,14 @@ export function getRedis(): Redis {
76
73
77
74
export const PUBLIC_URL = ( ( ) => {
78
75
if ( IS_PRODUCTION_SERVER ) {
79
-
80
- return `https://${ process . env . VERCEL_PROJECT_PRODUCTION_URL ! } ` ;
76
+ const productionUrl = demand ( "VERCEL_PROJECT_PRODUCTION_URL" ) ;
77
+ return `https://${ productionUrl } ` ;
81
78
} else if ( IS_PREVIEW_SERVER ) {
82
- return `https://${ process . env . VERCEL_URL ! } ` ;
79
+ const previewUrl = demand ( "VERCEL_URL" ) ;
80
+ return `https://${ previewUrl } ` ;
83
81
} else {
84
82
return `http://localhost:3003` ;
85
83
}
86
84
} ) ( ) ;
87
85
88
- export const VERCEL_AUTOMATION_BYPASS_SECRET = process . env . VERCEL_AUTOMATION_BYPASS_SECRET ! ;
86
+ export const VERCEL_AUTOMATION_BYPASS_SECRET = demand ( " VERCEL_AUTOMATION_BYPASS_SECRET" ) ;
0 commit comments