From 91460930a477b6c36de4b97a90bddad56ea44a3d Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Wed, 17 Dec 2025 15:16:04 +0100 Subject: [PATCH] Refactor Prisma logging and connection settings: Remove sensitive connection URL logging for security, and simplify logging configuration to only capture errors in the Prisma client setup. --- lib/prisma.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/prisma.ts b/lib/prisma.ts index ce54d63..97ff6fd 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -21,10 +21,6 @@ if (typeof databaseUrl !== "string") { throw new Error("DATABASE_URL must be a string"); } -// Logger l'URL de connexion (masquer le mot de passe pour la sécurité) -const logUrl = databaseUrl.replace(/:\/\/[^:]+:[^@]+@/, "://***:***@"); -console.log(`[Prisma] Connecting to PostgreSQL: ${logUrl}`); - const pool = new Pool({ connectionString: databaseUrl, }); @@ -39,10 +35,7 @@ export const prisma = globalForPrisma.prisma ?? new PrismaClient({ adapter, - log: - process.env.NODE_ENV === "development" - ? ["query", "error", "warn"] - : ["error"], + log: ["error"], }); if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;