-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.mjs
More file actions
43 lines (42 loc) · 1.45 KB
/
env.mjs
File metadata and controls
43 lines (42 loc) · 1.45 KB
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
// 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: {
PROJECT_REF: z.string().min(1),
UPLOADTHING_SECRET: z.string().min(1),
UPLOADTHING_APP_ID: z.string().min(1),
VISION_KEY: z.string().min(1),
VISION_ENDPOINT: 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: {
NEXT_PUBLIC_APP_URL: z.string().min(1),
NEXT_PUBLIC_SUPABASE_URL: z.string().min(1),
NEXT_PUBLIC_SUPABASE_ANON_KEY: 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: {
PROJECT_REF: process.env.PROJECT_REF,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
NEXT_PUBLIC_SUPABASE_URL: process.env.NEXT_PUBLIC_SUPABASE_URL,
NEXT_PUBLIC_SUPABASE_ANON_KEY: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
UPLOADTHING_SECRET: process.env.UPLOADTHING_SECRET,
UPLOADTHING_APP_ID: process.env.UPLOADTHING_APP_ID,
VISION_KEY: process.env.VISION_KEY,
VISION_ENDPOINT: process.env.VISION_ENDPOINT,
},
});