mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Adds a validation schema for the application's environment variables using the Zod library. The parsed environment variables are then exported as constants that can be imported throughout the application, replacing the direct use of process.env.
19 lines
393 B
TypeScript
19 lines
393 B
TypeScript
import { NODE_ENV } from '@/config/env';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
|
|
|
const DBClient = {
|
|
instance:
|
|
globalForPrisma.prisma ||
|
|
new PrismaClient({
|
|
log: ['info', 'warn'],
|
|
}),
|
|
};
|
|
|
|
if (NODE_ENV !== 'production') {
|
|
globalForPrisma.prisma = DBClient.instance;
|
|
}
|
|
|
|
export default DBClient;
|