From 5a8604298e3e4006d41328d3b7cd7e19ee7943c6 Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Mon, 19 Oct 2026 09:41:53 -0300 Subject: [PATCH] fix(api): fall back to defaults when LOG_LEVEL or MAIL_FROM are empty Compose defines unset optional variables as empty strings, so `??` kept "" and Pino crashed on startup with an empty level, leaving the api container unhealthy on Dokploy. Co-Authored-By: Claude Opus 5.5 --- apps/api/src/lib/logger.ts | 2 +- apps/api/src/lib/mailer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/lib/logger.ts b/apps/api/src/lib/logger.ts index 0b7c7e7..03fda00 100644 --- a/apps/api/src/lib/logger.ts +++ b/apps/api/src/lib/logger.ts @@ -7,7 +7,7 @@ const isProduction = process.env.NODE_ENV === 'production' * never use `console.log` in the backend. */ export const logger = pino({ - level: process.env.LOG_LEVEL ?? (isProduction ? 'info' : 'debug'), + level: process.env.LOG_LEVEL || (isProduction ? 'info' : 'debug'), ...(isProduction ? {} : { diff --git a/apps/api/src/lib/mailer.ts b/apps/api/src/lib/mailer.ts index 049ffec..b3fb2fb 100644 --- a/apps/api/src/lib/mailer.ts +++ b/apps/api/src/lib/mailer.ts @@ -11,7 +11,7 @@ export type Email = { } const apiKey = process.env.RESEND_API_KEY -const from = process.env.MAIL_FROM ?? 'Superlist ' +const from = process.env.MAIL_FROM || 'Superlist ' let client: Resend | null = null