File size: 571 Bytes
db242f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import { CustomPrismaClientFactory } from 'nestjs-prisma';
import { Injectable } from '@nestjs/common';
import {
type ExtendedPrismaClient,
createExtendedPrismaClient,
} from './prisma.extension';
@Injectable()
export class ExtendedPrismaConfigService
implements CustomPrismaClientFactory<ExtendedPrismaClient>
{
private readonly url: string;
constructor() {
// TODO Read from configuration file
this.url = process.env.DATABASE_URL;
}
createPrismaClient(): ExtendedPrismaClient {
return createExtendedPrismaClient({ url: this.url });
}
}
|