-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.mjs
53 lines (52 loc) · 2.29 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
// src/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: {
AUTH_GOOGLE_ID: z.string().min(1),
AUTH_GOOGLE_SECRET: z.string().min(1),
FIREBASE_PROJECT_ID: z.string().min(1),
FIREBASE_PRIVATE_KEY: z.string().min(1),
FIREBASE_CLIENT_EMAIL: z.string().min(1),
NODE_ENV: z.enum(["development", "test", "production"]),
},
/*
* Environment variables available on the client (and server).
*
* 💡 You'll get type errors if these are not prefixed with NEXT_PUBLIC_.
*/
client: {
NEXT_PUBLIC_FIREBASE_APP_ID: z.string().min(1),
NEXT_PUBLIC_FIREBASE_API_KEY: z.string().min(1),
NEXT_PUBLIC_FIREBASE_PROJECT_ID: z.string().min(1),
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: z.string().min(1),
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: z.string().min(1),
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: z.string().min(1),
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: 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: {
NODE_ENV: process.env.NODE_ENV,
AUTH_GOOGLE_ID: process.env.AUTH_GOOGLE_ID,
AUTH_GOOGLE_SECRET: process.env.AUTH_GOOGLE_SECRET,
FIREBASE_PROJECT_ID: process.env.FIREBASE_PROJECT_ID,
FIREBASE_PRIVATE_KEY: process.env.FIREBASE_PRIVATE_KEY,
FIREBASE_CLIENT_EMAIL: process.env.FIREBASE_CLIENT_EMAIL,
NEXT_PUBLIC_FIREBASE_APP_ID: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
NEXT_PUBLIC_FIREBASE_API_KEY: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
NEXT_PUBLIC_FIREBASE_PROJECT_ID: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
},
});