-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.js
More file actions
54 lines (51 loc) · 1.85 KB
/
env.js
File metadata and controls
54 lines (51 loc) · 1.85 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
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
export const env = createEnv({
/**
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
server: {
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
SINGLESTORE_USER: z.string(),
SINGLESTORE_PASSWORD: z.string(),
SINGLESTORE_HOST: z.string(),
SINGLESTORE_PORT: z.coerce.number().default(3306),
SINGLESTORE_DATABASE: z.string(),
},
/**
* Specify your client-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars. To expose them to the client, prefix them with
* `NEXT_PUBLIC_`.
*/
client: {
NEXT_PUBLIC_POSTHOG_KEY: z.string(),
NEXT_PUBLIC_POSTHOG_HOST: z.string(),
},
/**
* 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.
*/
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
SINGLESTORE_USER: process.env.SINGLESTORE_USER,
SINGLESTORE_PASSWORD: process.env.SINGLESTORE_PASSWORD,
SINGLESTORE_HOST: process.env.SINGLESTORE_HOST,
SINGLESTORE_PORT: process.env.SINGLESTORE_PORT,
SINGLESTORE_DATABASE: process.env.SINGLESTORE_DATABASE,
NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,
NEXT_PUBLIC_POSTHOG_HOST: process.env.NEXT_PUBLIC_POSTHOG_HOST,
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
* useful for Docker builds.
*/
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
/**
* Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
* `SOME_VAR=''` will throw an error.
*/
emptyStringAsUndefined: true,
});