This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
env.mjs
109 lines (94 loc) · 2.57 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* eslint-disable no-process-env */
// @ts-check
import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod';
const toggle = z
.enum(['true', 'false', '0', '1'])
.transform((v) => v === 'true' || v === '1');
export const env = createEnv({
skipValidation: process.env.CI === 'true',
/**
* Environment variables available on the client (and server).
*
* 💡 You'll get type errors if these are not prefixed with NEXT_PUBLIC_.
*/
client: {
/**
* @enable WebSockets
*/
// NEXT_PUBLIC_PUSHER_APP_KEY: z.string().min(1),
// NEXT_PUBLIC_PUSHER_CLUSTER: z.string().min(1),
},
/**
* Serverside Environment variables, not available on the client.
* Will throw if you access these variables on the client.
*/
server: {
ANALYZE: toggle.default('false'),
/**
* @enable LuciaAuth
*/
// AUTH_GITHUB_ID: z.string().min(1),
// AUTH_GITHUB_SECRET: z.string().min(1),
DATABASE_PREFIX: z.string().default(''),
/**
* @enable Drizzle
*/
// DATABASE_URL: z.string().url(),
NODE_ENV: z
.enum(['development', 'production', 'test'])
.default('development'),
/**
* @enable WebSockets
*/
// PUSHER_APP_ID: z.string().min(1),
// PUSHER_SECRET: z.string().min(1),
/**
* Set PWA environment variable to true to enable PWA
* (in env.local and/or deployment environment variables)
* @enable PWA
*/
PWA: toggle.default('false'),
},
/**
* 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: {
/**
* ------
* Client
* ------
*/
/**
* @enable WebSockets
*/
// NEXT_PUBLIC_PUSHER_APP_KEY: process.env.NEXT_PUBLIC_PUSHER_APP_KEY,
// NEXT_PUBLIC_PUSHER_CLUSTER: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
/**
* ------
* Server
* ------
*/
ANALYZE: process.env.ANALYZE,
/**
* @enable LuciaAuth
*/
// AUTH_GITHUB_ID: process.env.AUTH_GITHUB_ID,
// AUTH_GITHUB_SECRET: process.env.AUTH_GITHUB_SECRET,
DATABASE_PREFIX: process.env.DATABASE_PREFIX,
/**
* @enable Drizzle
*/
// DATABASE_URL: process.env.DATABASE_URL,
NODE_ENV: process.env.NODE_ENV,
/**
* @enable WebSockets
*/
// PUSHER_APP_ID: process.env.PUSHER_APP_ID,
// PUSHER_SECRET: process.env.PUSHER_SECRET,
PWA: process.env.PWA,
},
});