Skip to content

Commit 9479421

Browse files
committed
Document and use prisma_options
Fixes #434
1 parent af5e22f commit 9479421

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ Copy `config-skel.json` to `config.json` and adjust the options (all options are
452452
- `google_oauth2`:
453453
- `enabled`: if true, the login endpoint will accept the token for authenticating with Google OAuth2 token. Note that you have to set "GOOGLE_CLIENT_ID" in your environment
454454
to your API Key Client ID.
455+
- `prisma_options`: these settings will be passed to Prisma PGClient creation. See [Prisma documentation](https://www.prisma.io/docs/orm/reference/prisma-client-reference#prismaclient) for possible values.
455456

456457
## 5. Prepare the database
457458

lib/db.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88

99
import { PrismaPg } from '@prisma/adapter-pg'
1010
import { PrismaClient } from '../generated/prisma/index.js'
11+
import * as Config from './config.mjs'
1112

12-
const adapter = new PrismaPg({
13+
const pclient = Config.get()?.prisma_options || {}
14+
15+
pclient.adapter = new PrismaPg({
1316
connectionString: process.env.PASSWEAVERAPI_PRISMA_URL
1417
})
1518

16-
const DB = new PrismaClient({ adapter })
19+
const DB = new PrismaClient(pclient)
1720

1821
export default DB

0 commit comments

Comments
 (0)