Skip to content

Commit 03d4932

Browse files
committed
properly check enviroment
1 parent 0b7891b commit 03d4932

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646

4747
- name: Create test user
4848
run: npx tsx testDb.ts
49+
env:
50+
NODE_ENV: test
4951

5052

5153
- name: Install Playwright Browsers

labman/src/lib/prisma.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { PrismaClient } from '@/generated/prisma'
1+
import dotenv from 'dotenv'
2+
3+
dotenv.config({
4+
path: process.env.NODE_ENV === 'test' ? '.env.test' : '.env'
5+
})
6+
7+
console.log(process.env.DATABASE_URL)
8+
9+
import { PrismaClient } from '@/generated/prisma'
210

311
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
412

@@ -9,3 +17,4 @@ if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
917

1018
export default prisma
1119

20+

0 commit comments

Comments
 (0)