Hoang Nguyen
init app
f75d7fa
import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod';
export const Env = createEnv({
server: {
ARCJET_KEY: z.string().startsWith('ajkey_').optional(),
CLERK_SECRET_KEY: z.string().min(1),
DATABASE_URL: z.string().optional(),
LOGTAIL_SOURCE_TOKEN: z.string().optional(),
},
client: {
NEXT_PUBLIC_APP_URL: z.string().optional(),
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
NEXT_PUBLIC_CLERK_SIGN_IN_URL: z.string().min(1),
},
shared: {
NODE_ENV: z.enum(['test', 'development', 'production']).optional(),
},
// You need to destructure all the keys manually
runtimeEnv: {
ARCJET_KEY: process.env.ARCJET_KEY,
CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
DATABASE_URL: process.env.DATABASE_URL,
LOGTAIL_SOURCE_TOKEN: process.env.LOGTAIL_SOURCE_TOKEN,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
NEXT_PUBLIC_CLERK_SIGN_IN_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL,
NODE_ENV: process.env.NODE_ENV,
},
});