diff --git a/docs/index.md b/docs/index.md index 0dbedc4..800dc74 100644 --- a/docs/index.md +++ b/docs/index.md @@ -452,6 +452,7 @@ Copy `config-skel.json` to `config.json` and adjust the options (all options are - `google_oauth2`: - `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 to your API Key Client ID. +- `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. ## 5. Prepare the database diff --git a/lib/db.mjs b/lib/db.mjs index e934c6d..bb5081e 100644 --- a/lib/db.mjs +++ b/lib/db.mjs @@ -8,11 +8,14 @@ import { PrismaPg } from '@prisma/adapter-pg' import { PrismaClient } from '../generated/prisma/index.js' +import * as Config from './config.mjs' -const adapter = new PrismaPg({ +const pclient = Config.get()?.prisma_options || {} + +pclient.adapter = new PrismaPg({ connectionString: process.env.PASSWEAVERAPI_PRISMA_URL }) -const DB = new PrismaClient({ adapter }) +const DB = new PrismaClient(pclient) export default DB