Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PRISMA prefix for env variables of prisma database #92

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
FIREBASE_AUTH_EMULATOR_HOST: "127:0:0:1:9099"
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CI_TOKEN }}
FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
DATABASE_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }}
PRISMA_DATABASE_URL: ${{ secrets.SYSTEMTEST_DATABASE_URL }}
PRISMA_DATABASE_PASSWORD: ${{ secrets.SYSTEMTEST_DATABASE_PASSWORD }}

jobs:
mainbuild:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ docker image prune -f

Next steps:

1. Set the DATABASE_URL in the .env file to point to your existing database. If
1. Set the PRISMA_DATABASE_URL in the .env file to point to your existing database. If
your database has no tables yet, read https://pris.ly/d/getting-started
2. Set the provider of the datasource block in schema.prisma to match your
database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb.
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- "5001:5001"
environment:
PORT: 5001
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

matching-service:
build:
Expand All @@ -21,7 +21,7 @@ services:
- "5002:5002"
environment:
PORT: 5002
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

collaboration-service:
build:
Expand All @@ -32,7 +32,7 @@ services:
- "5003:5003"
environment:
PORT: 5003
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

question-service:
build:
Expand Down
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ generator client {

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
url = env("PRISMA_DATABASE_URL")
}

// todo rename for colalboration service
Expand Down
6 changes: 3 additions & 3 deletions services/user-service/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# User Service

## Pre-requisites:
You need to set the environment variable `DATABASE_URL` in `prisma/schema.prisma`.
You need to set the environment variable `PRISMA_DATABASE_URL` in `prisma/schema.prisma`.

If you do so with an `.env` file, you need to generate the prisma client/migrate prisma as follows:

Expand Down Expand Up @@ -72,8 +72,8 @@ What this command does:

You need to pass in the following environment variables through the above-mentioned `.env`-type file:
```
DATABASE_URL="postgresql://postgres:${password}@localhost:5430/peerprepdb-user-service-systemtest?schema=public"
DATABASE_PASSWORD="${The password you want to pass in. This must match the password in the above variable}"
PRISMA_DATABASE_URL="postgresql://postgres:${password}@localhost:5430/peerprepdb-user-service-systemtest?schema=public"
PRISMA_DATABASE_PASSWORD="${The password you want to pass in. This must match the password in the above variable}"
```

If you want to run this in a CI workflow, run:
Expand Down
2 changes: 1 addition & 1 deletion services/user-service/src/db/prismaClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PrismaClient} from '@prisma/client';

const prismaClient : PrismaClient = new PrismaClient({
datasourceUrl: process.env.DATABASE_URL
datasourceUrl: process.env.PRISMA_DATABASE_URL
});

export default prismaClient;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_DB: peerprepdb-user-service-systemtest
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_PASSWORD: ${PRISMA_DATABASE_PASSWORD}