-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.ts
More file actions
65 lines (60 loc) · 2.03 KB
/
env.ts
File metadata and controls
65 lines (60 loc) · 2.03 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
export const env = createEnv({
server: {
DATABASE_URI: z.string().url(),
BETTER_AUTH_SECRET: z.string().min(1),
GITHUB_CLIENT_ID: z.string().min(1),
GITHUB_CLIENT_SECRET: z.string().min(1),
GITHUB_APP_ID: z.string().min(1),
GITHUB_APP_PRIVATE_KEY: z.string().min(1),
REDIS_REST_URL: z.string().url(),
REDIS_REST_TOKEN: z.string().min(1),
REDIS_URI: z.string().url(),
QDRANT_API_KEY: z.string().min(1),
OPENAI_API_KEY: z.string().min(1).startsWith("sk-proj-"),
QDRANT_URL: z.string().url().optional().default("http://localhost:6333"),
VERCEL_OIDC_TOKEN: z.string().min(1),
LANGGRAPH_API_URL: z
.string()
.url()
.optional()
.default("http://localhost:2024"),
LANGSMITH_API_KEY: z.string().min(1),
NODE_ENV: z
.enum(["development", "production"])
.optional()
.default("development"),
},
/**
* The prefix that client-side variables must have. This is enforced both at
* a type-level and at runtime.
*/
clientPrefix: "NEXT_PUBLIC_",
client: {
NEXT_PUBLIC_APP_URL: z
.string()
.url()
.default("http://localhost:3000")
.optional(),
},
/**
* What object holds the environment variables at runtime. This is usually
* `process.env` or `import.meta.env`.
*/
runtimeEnv: process.env,
/**
* By default, this library will feed the environment variables directly to
* the Zod validator.
*
* This means that if you have an empty string for a value that is supposed
* to be a number (e.g. `PORT=` in a ".env" file), Zod will incorrectly flag
* it as a type mismatch violation. Additionally, if you have an empty string
* for a value that is supposed to be a string with a default value (e.g.
* `DOMAIN=` in an ".env" file), the default value will never be applied.
*
* In order to solve these issues, we recommend that all new projects
* explicitly specify this option as true.
*/
emptyStringAsUndefined: true,
});