/
githubmirror
/
trpc
Обзор
Документация
Войти
/
githubmirror
/
trpc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/next-prisma-starter/src/server/env.ts
21 строка
537 B
Julius Marminge
chore(deps): modernize deps & tooling (#6164)
30 окт 2024, 21:40
Не верифицирован
30 окт 2024, 21:40
84e267e
Код
Авторство
О чём код?
/** * This file is included in `/next.config.ts` which ensures the app isn't built with invalid env vars. * It has to be a `.js`-file to be imported there. */ import { z } from 'zod'; const envSchema = z.object({ DATABASE_URL: z.string().url(), NODE_ENV: z.enum(['development', 'test', 'production']), }); const _env = envSchema.safeParse(process.env); if (!_env.success) { throw new Error( '❌ Invalid environment variables: ' + JSON.stringify(_env.error.format(), null, 4), ); } export const env = _env.data;