production: docker + nginx config for rf-flux.com
Deploy to VPS / deploy (push) Has been cancelled

This commit is contained in:
2026-03-20 13:46:05 -05:00
parent b275b19f08
commit fc24313f15
187 changed files with 20977 additions and 767 deletions
+31
View File
@@ -0,0 +1,31 @@
// src/lib/prisma.ts
// ✅ CORRECCIÓN: Validación de DATABASE_URL + configuración del pool de conexiones
import { PrismaClient } from '@prisma/client';
import { Pool } from 'pg';
import { PrismaPg } from '@prisma/adapter-pg';
const globalForPrisma = global as unknown as { prisma: PrismaClient };
const connectionString = process.env.DATABASE_URL;
if (!connectionString) {
throw new Error(
"❌ DATABASE_URL is not defined. " +
"Make sure it's set in your .env file or Docker environment variables. " +
"Example: DATABASE_URL=postgresql://user:password@db:5432/flux"
);
}
const pool = new Pool({
connectionString,
max: 10, // Máximo de conexiones simultáneas
idleTimeoutMillis: 30000, // Cerrar conexiones inactivas después de 30s
connectionTimeoutMillis: 5000, // Timeout al intentar conectar
});
const adapter = new PrismaPg(pool as any);
export const prisma = globalForPrisma.prisma || new PrismaClient({ adapter });
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;