Files
deer-flow/web/src/env.js

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2025-04-17 14:26:41 +08:00
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
2025-04-17 12:02:23 +08:00
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"]),
AMPLITUDE_API_KEY: z.string().optional(),
GITHUB_OAUTH_TOKEN: z.string().optional(),
2025-04-17 12:02:23 +08:00
},
/**
* 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: {
2025-04-17 16:39:27 +08:00
NEXT_PUBLIC_API_URL: z.string().optional(),
2025-05-02 21:09:31 +08:00
NEXT_PUBLIC_STATIC_WEBSITE_ONLY: z.boolean().optional(),
2025-04-17 12:02:23 +08:00
},
/**
* 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,
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
2025-05-02 21:09:31 +08:00
NEXT_PUBLIC_STATIC_WEBSITE_ONLY:
process.env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true",
AMPLITUDE_API_KEY: process.env.AMPLITUDE_API_KEY,
GITHUB_OAUTH_TOKEN: process.env.GITHUB_OAUTH_TOKEN,
2025-04-17 12:02:23 +08:00
},
/**
* 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,
});