Spaces:
Runtime error
Runtime error
Download next/src/env/server.mjs from dia-gov/AgentGPT-Web-GUI: direct link, hf CLI and curl.
- Browser
- Download file 844 Bytes
-
https://huggingface.co/spaces/dia-gov/AgentGPT-Web-GUI/resolve/main/next/src/env/server.mjs
- Command line
-
hf download hf://spaces/dia-gov/AgentGPT-Web-GUI/next/src/env/server.mjs
-
curl -L -o server.mjs https://huggingface.co/spaces/dia-gov/AgentGPT-Web-GUI/resolve/main/next/src/env/server.mjs
844 Bytes
| // @ts-check | |
| /** | |
| * This file is included in `/next.config.mjs` which ensures the app isn't built with invalid env vars. | |
| * It has to be a `.mjs`-file to be imported there. | |
| */ | |
| import { env as clientEnv, formatErrors } from "./client.mjs"; | |
| import { serverSchema, serverEnv } from "./schema.mjs"; | |
| const _serverEnv = serverSchema.safeParse(serverEnv); | |
| if (!_serverEnv.success) { | |
| console.error( | |
| "❌ Invalid environment variables:\n", | |
| ...formatErrors(_serverEnv.error.format()), | |
| ); | |
| throw new Error("Invalid environment variables"); | |
| } | |
| for (let key of Object.keys(_serverEnv.data)) { | |
| if (key.startsWith("NEXT_PUBLIC_")) { | |
| console.warn("❌ You are exposing a server-side env-variable:", key); | |
| throw new Error("You are exposing a server-side env-variable"); | |
| } | |
| } | |
| export const env = { ..._serverEnv.data, ...clientEnv }; | |