Skip to content

Commit

Permalink
another one
Browse files Browse the repository at this point in the history
  • Loading branch information
d-ivashchuk committed Mar 24, 2024
1 parent cc19690 commit 1c23b6d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ export const env = createEnv({
process.env.NODE_ENV === "production"
? z.string()
: z.string().optional(),
NEXTAUTH_URL: z.preprocess(
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
// Since NextAuth.js automatically uses the VERCEL_URL if present.
(str) => process.env.VERCEL_URL ?? str,
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
process.env.VERCEL ? z.string() : z.string().url(),
),
NEXTAUTH_URL:
process.env.NODE_ENV === "production"
? z.preprocess(
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
// Since NextAuth.js automatically uses the VERCEL_URL if present.
(str) => process.env.VERCEL_URL ?? str,
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
process.env.VERCEL ? z.string() : z.string().url(),
)
: z.string().optional(),
DISCORD_CLIENT_ID:
process.env.NODE_ENV === "production"
? z.string()
Expand Down

0 comments on commit 1c23b6d

Please sign in to comment.