Skip to content

Commit

Permalink
feat: load env condtionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoudgalalz committed Dec 11, 2023
1 parent f2d3efc commit 3215476
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util/database.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
import 'dotenv/config'

process.env && process.env.NODE_ENV === "development" ?
import('dotenv/config')
.then(()=> console.log("Loaded env from .env"))
.catch(()=>console.log("Please create .env file"))
: console.log("Production by default")


export const prisma = new PrismaClient({
Expand Down

0 comments on commit 3215476

Please sign in to comment.