Skip to content

Commit

Permalink
Fix vercel preview environment (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomitheninja authored Sep 14, 2024
1 parent a2e3f9c commit d23592e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/src/config/environment.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import * as env from 'env-var';

dotenv.config();

const fallbackToPreviewFrontend =
process.env.VERCEL_ENV === 'preview' || process.env.FORCE_LAMBDA_API === '1';

export const FRONTEND_CALLBACK =
process.env.VERCEL_ENV === 'preview' || process.env.FORCE_LAMBDA_API === '1'
? `https://${process.env.VERCEL_BRANCH_URL!}`
!process.env.FRONTEND_CALLBACK && fallbackToPreviewFrontend
? process.env.VERCEL_BRANCH_URL!
: env.get('FRONTEND_CALLBACK').required().asString();

export const JWT_SECRET = env.get('JWT_SECRET').required().asString();
Expand Down

0 comments on commit d23592e

Please sign in to comment.