diff --git a/api/.env.example b/api/.env.example index 1d568703..a408fcc6 100644 --- a/api/.env.example +++ b/api/.env.example @@ -2,3 +2,13 @@ PORT=3001 DATABASE_URL=postgresql://postgres:postgres@localhost:5432/aoweb TOKEN_AUTH=changeme CORS_ORIGIN=http://localhost:3000 + +# Site configuration +SITE_URL=http://localhost:3000 + +# Amazon SES (Password Reset emails) +SES_REGION=us-east-1 +SES_ACCESS_KEY_ID= +SES_SECRET_ACCESS_KEY= +SES_FROM_EMAIL=noreply@aoweb.online +SES_FROM_NAME="AOWeb" diff --git a/api/src/lib/email.ts b/api/src/lib/email.ts index 7d114dad..a6952382 100644 --- a/api/src/lib/email.ts +++ b/api/src/lib/email.ts @@ -10,8 +10,14 @@ type PasswordResetEmailInput = { let sesClient: SESv2Client | null = null; function getSesClient(): SESv2Client { - if (!config.sesRegion || !config.sesAccessKeyId || !config.sesSecretAccessKey || !config.sesFromEmail) { - throw new Error("Amazon SES no esta configurado"); + const missing: string[] = []; + if (!config.sesRegion) missing.push("SES_REGION"); + if (!config.sesAccessKeyId) missing.push("SES_ACCESS_KEY_ID"); + if (!config.sesSecretAccessKey) missing.push("SES_SECRET_ACCESS_KEY"); + if (!config.sesFromEmail) missing.push("SES_FROM_EMAIL"); + + if (missing.length > 0) { + throw new Error(`Amazon SES no esta configurado. Faltan variables: ${missing.join(", ")}`); } if (!sesClient) {