-
Notifications
You must be signed in to change notification settings - Fork 1
/
env.mjs
64 lines (59 loc) · 2.32 KB
/
env.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// env.mjs
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
export const env = createEnv({
/*
* ServerSide Environment variables, not available on the client.
* Will throw if you access these variables on the client.
*/
server: {
// Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
CLERK_SECRET_KEY: z.string().min(1),
// Vercel Postgresql
POSTGRES_URL: z.string().min(1),
POSTGRES_PRISMA_URL: z.string().min(1),
POSTGRES_URL_NON_POOLING: z.string().min(1),
POSTGRES_USER: z.string().min(1),
POSTGRES_HOST: z.string().min(1),
POSTGRES_PASSWORD: z.string().min(1),
POSTGRES_DATABASE: z.string().min(1),
},
/*
* Environment variables available on the client (and server).
*
* 💡 You'll get type errors if these are not prefixed with NEXT_PUBLIC_.
*/
client: {
// Clerk
NEXT_PUBLIC_CLERK_SIGN_IN_URL: z.string().min(1),
NEXT_PUBLIC_CLERK_SIGN_UP_URL: z.string().min(1),
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL: z.string().min(1),
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL: z.string().min(1),
NEXT_PUBLIC_APP_URL: z.string().min(1),
},
/*
* Due to how Next.js bundles environment variables on Edge and Client,
* we need to manually destructure them to make sure all are included in bundle.
*
* 💡 You'll get type errors if not all variables from `server` & `client` are included here.
*/
runtimeEnv: {
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
NEXT_PUBLIC_CLERK_SIGN_IN_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL,
NEXT_PUBLIC_CLERK_SIGN_UP_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL,
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL:
process.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL,
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL:
process.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
POSTGRES_URL: process.env.POSTGRES_URL,
POSTGRES_PRISMA_URL: process.env.POSTGRES_PRISMA_URL,
POSTGRES_URL_NON_POOLING: process.env.POSTGRES_URL_NON_POOLING,
POSTGRES_USER: process.env.POSTGRES_USER,
POSTGRES_HOST: process.env.POSTGRES_HOST,
POSTGRES_PASSWORD: process.env.POSTGRES_PASSWORD,
POSTGRES_DATABASE: process.env.POSTGRES_DATABASE,
},
});