feat: update environment configuration for production and add Docker support
This commit is contained in:
+4
-2
@@ -5,8 +5,10 @@ import path from 'path';
|
||||
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
|
||||
|
||||
function createPrismaClient() {
|
||||
const dbPath = path.resolve(process.cwd(), 'prisma/lootah.db');
|
||||
const adapter = new PrismaLibSql({ url: `file:${dbPath}` });
|
||||
// Use DATABASE_URL if set (production/Coolify), otherwise fall back to local path.
|
||||
const dbUrl = process.env.DATABASE_URL
|
||||
?? `file:${path.resolve(process.cwd(), 'prisma/lootah.db')}`;
|
||||
const adapter = new PrismaLibSql({ url: dbUrl });
|
||||
return new PrismaClient({ adapter } as ConstructorParameters<typeof PrismaClient>[0]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user