-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.ts
56 lines (51 loc) · 1.73 KB
/
env.ts
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
import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod';
export const env = createEnv({
shared: {
NODE_ENV: z.enum(['development', 'test', 'production']),
SKIP_ENV_VALIDATION: z.string().optional(),
NEXT_PUBLIC_APP_URL: z.string().url(),
VERCEL_APP_URL: z.string().url().optional(),
},
/**
* Server-side environment variables schema
*/
server: {
NODE_ENV: z.enum(['development', 'test', 'production']),
BETTER_AUTH_URL: z.string().url(),
BETTER_AUTH_SECRET: z.string(),
GITHUB_CLIENT_ID: z.string(),
GITHUB_CLIENT_SECRET: z.string(),
GITHUB_REDIRECT_URI: z.string().url(),
RESEND_API_KEY: z.string(),
EMAIL_FROM: z.string(),
// TEST_EMAIL: z.string(),
TURSO_DATABASE_URL: z.string(),
TURSO_AUTH_TOKEN: z.string(),
},
/**
* Client-side environment variables schema
*/
client: {
NEXT_PUBLIC_APP_URL: z.string().url(),
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION: z.string().optional(),
},
/**
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
* middlewares) or client-side so we need to destruct manually. This will allow you to use
* the env variables in the client side.
*/
experimental__runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
SKIP_ENV_VALIDATION: process.env.SKIP_ENV_VALIDATION,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
VERCEL_APP_URL: process.env.VERCEL_APP_URL,
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION:
process.env.NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION,
},
/**
* Skip validation of environment variables during build - usefule when you are using
* the env variables in the client side
*/
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
});