11// Disable the following rule because this file is the intended place to declare
22// 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 */
44
55import { Redis } from 'ioredis' ;
66import "server-only" ;
@@ -63,10 +63,7 @@ export const ENABLE_ACCESSIBILITY_REPORTING =
6363let redisClient : Redis | undefined ;
6464
6565export 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" ) ;
7067 if ( redisClient ) {
7168 return redisClient ;
7269 }
@@ -76,13 +73,14 @@ export function getRedis(): Redis {
7673
7774export const PUBLIC_URL = ( ( ) => {
7875 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 } ` ;
8178 } else if ( IS_PREVIEW_SERVER ) {
82- return `https://${ process . env . VERCEL_URL ! } ` ;
79+ const previewUrl = demand ( "VERCEL_URL" ) ;
80+ return `https://${ previewUrl } ` ;
8381 } else {
8482 return `http://localhost:3003` ;
8583 }
8684} ) ( ) ;
8785
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