Skip to content

Commit

Permalink
fixed env variable loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushmishra1416 committed May 27, 2024
1 parent 8a090ba commit 9785b09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# DONT CHANGE FOR RUNNING WITH DOCKER
# DATABASE_URL="postgresql://postgres:postgres@db:5432/cms?schema=public"
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/cms?schema=public"

11 changes: 8 additions & 3 deletions scripts/run-integration.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# docker compose up -d
DIR="$(cd "$(dirname "$0")" && pwd)"
export $(grep -v '^#' .env.test | xargs)
docker run -d \
--name db \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=mydatabase \
-e POSTGRES_DB=cms \
-p 5432:5432 \
postgres
echo '🟡 - Waiting for database to be ready...'
/Users/piyush/cms/scripts/wait-for-it.sh "postgresql://postgres" -- echo '🟢 - Database is ready!'
npx prisma migrate dev --name init --schema=./prisma/schema.prisma
$DIR/wait-for-it.sh "${DATABASE_URL}" -- echo '🟢 - Database is ready!'
echo $DATABASE_URL
npx prisma migrate dev --name init
vitest -c ./vitest.config.integration.ts
docker stop db && docker rm db
# docker compose down

0 comments on commit 9785b09

Please sign in to comment.