mirror of
https://github.com/aljazceru/AgentGPT.git
synced 2025-12-18 06:24:20 +01:00
🔧 Update documentation on environment variables
This commit is contained in:
13
src/env/schema.mjs
vendored
13
src/env/schema.mjs
vendored
@@ -1,6 +1,10 @@
|
||||
// @ts-check
|
||||
import { z } from "zod";
|
||||
|
||||
const requiredForProduction = () => process.env.NODE_ENV === "production"
|
||||
? z.string().min(1).trim()
|
||||
: z.string().min(1).trim().optional()
|
||||
|
||||
/**
|
||||
* Specify your server-side environment variables schema here.
|
||||
* This way you can ensure the app isn't built with invalid env vars.
|
||||
@@ -8,10 +12,7 @@ import { z } from "zod";
|
||||
export const serverSchema = z.object({
|
||||
DATABASE_URL: z.string().url(),
|
||||
NODE_ENV: z.enum(["development", "test", "production"]),
|
||||
NEXTAUTH_SECRET:
|
||||
process.env.NODE_ENV === "production"
|
||||
? z.string().min(1)
|
||||
: z.string().min(1).optional(),
|
||||
NEXTAUTH_SECRET: requiredForProduction(),
|
||||
NEXTAUTH_URL: z.preprocess(
|
||||
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
|
||||
// Since NextAuth.js automatically uses the VERCEL_URL if present.
|
||||
@@ -19,8 +20,6 @@ export const serverSchema = z.object({
|
||||
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
|
||||
process.env.VERCEL ? z.string() : z.string().url(),
|
||||
),
|
||||
DISCORD_CLIENT_ID: z.string(),
|
||||
DISCORD_CLIENT_SECRET: z.string(),
|
||||
OPENAI_API_KEY: z.string()
|
||||
});
|
||||
|
||||
@@ -34,8 +33,6 @@ export const serverEnv = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
|
||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
||||
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID,
|
||||
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET,
|
||||
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user