Skip to content

Commit

Permalink
Fix issue with Prisma not supporting env in provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Yureien committed Mar 29, 2024
1 parent c0afcbc commit b0e6d9c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ PORT=3000
SALT="this is a very insecure salt, change it"

DB_NAME=mydb
DB_PROVIDER=postgres
DB_HOST=db # db refers to the name of the service in docker-compose.yml
DB_USER=johndoe
DB_PASSWORD=randompassword
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ See [cli/README.md](cli/README.md) for detailed instructions and library usage.

**Requirements:** Node.js (tested on 18+, should work with 14+), and a SQL database (tested on PostgreSQL, should work with MySQL and SQLite).

Right now, my instance is using PostgreSQL on Vercel. However, it can be run using any SQL DB such as SQLite or MySQL. To use other backends, please update the provider in [schema.prisma](src/lib/server/prisma/schema.prisma)
Right now, my instance is using PostgreSQL on Vercel.

### .env Configuration

By default, it is configured to use PostgreSQL. However, it can be run using any SQL DB such as SQLite or MySQL. To use other backends, please update the provider in [schema.prisma](src/lib/server/prisma/schema.prisma).

- `DB_NAME` is the database name;
- `DB_PROVIDER` uses 'postgres' by default, but can be changed to MySQL or SQLite.
- `DB_HOST` database host (defaults to 'db', but can be changed to aything like localhost)
- `DB_USER` database user
- `DB_PORT` database port 5432
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ generator client {
}

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

Expand Down

0 comments on commit b0e6d9c

Please sign in to comment.