feat: Adds new customPrisma for hosted API (#3055)

* feat: customPrisma for hosted API access

* fix: 24h not 24 days for expiry cache in customPrisma calls

* fix: move PRISMA_CLIENT_CACHING_TIME to API

Co-authored-by: Agusti Fernandez Pardo <git@agusti.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Agusti Fernandez Pardo 2022-06-14 19:11:39 +02:00 committed by GitHub
parent 7bef84a8d0
commit 22460a460b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,9 @@ if (!!process.env.NEXT_PUBLIC_DEBUG) prismaOptions.log = ["query", "error", "war
export const prisma = globalThis.prisma || new PrismaClient(prismaOptions);
export const customPrisma = (options: Prisma.PrismaClientOptions) =>
new PrismaClient({ ...prismaOptions, ...options });
if (process.env.NODE_ENV !== "production") {
globalThis.prisma = prisma;
}