Skip to content

Commit 701be58

Browse files
committed
Fix: Change enviroment variables
1 parent 65d7510 commit 701be58

File tree

4 files changed

+7
-29
lines changed

4 files changed

+7
-29
lines changed

email-api/.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ EXPIRE_IN=1d
66
DATABASE_URL=postgres://user:password@localhost:5432/your_db
77

88
SMTP_HOST=smtp-relay.brevo.com
9-
SMTP_PORT=587
10-
EMAIL=
11-
GOOGLE_APP_PASSWORD=
9+
SMTP_PORT=2525
10+
EMAIL=correo asignado por brevo
11+
GOOGLE_APP_PASSWORD=contraseña asignada por brevo

email-api/src/config/env.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export const env = {
44
ENV,
55
PORT: process.env.PORT || 3000,
66
DATABASE_URL: process.env.DATABASE_URL || '',
7-
SMTP_HOST: process.env.SMTP_HOST || 'smtp-relay.brevo.com', // Valor por defecto
8-
SMTP_PORT: process.env.SMTP_PORT || '587',
9-
EMAIL: process.env.EMAIL || '',
7+
SMTP_HOST: process.env.SMTP_HOST || 'smtp-relay.brevo.com',
8+
SMTP_PORT: process.env.SMTP_PORT || '2525', // Actualiza el default a 2525
9+
EMAIL: process.env.EMAIL || 'a735a0001@smtp-brevo.com',
1010
GOOGLE_APP_PASSWORD: process.env.GOOGLE_APP_PASSWORD || '', // Aquí irá API Key de Brevo
1111
SECRET_KEY: process.env.SECRET_KEY || '',
1212
EXPIRE_IN: process.env.EXPIRE_IN || '1d'

email-api/src/mails/mailer.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,26 @@ import { env } from '../config/env.js'
33
import DOMPurify from 'isomorphic-dompurify'; // Esta librería ya trae su propio DOM interno
44

55
const transporter = nodemailer.createTransport({
6-
//pool: true, // Reutiliza la conexión (más eficiente en Render)
76
host: env.SMTP_HOST,
87
port: parseInt(env.SMTP_PORT),
98
secure: false, // true para puerto 465, false para otros
10-
//family: 4,
119
auth: {
1210
user: env.EMAIL,
1311
pass: env.GOOGLE_APP_PASSWORD,
1412
},
1513
tls: {
1614
rejectUnauthorized: false, // Esto ayuda a evitar bloqueos de certificados en Render
1715
servername: env.SMTP_HOST,
18-
//minVersion: 'TLSv1.2'
1916
},
2017
connectionTimeout: 20000, // Aumentamos a 40 segundos
21-
//greetingTimeout: 30000, // 30 segundos para el saludo
22-
//socketTimeout: 60000 // 60 segundos de socket abierto
2318
});
2419

2520
export const sendEmail = async ({ to, subject, html }) => {
2621
// Ahora DOMPurify funciona directamente sin configurar nada más
2722
const cleanHtml = DOMPurify.sanitize(html || '');
2823

2924
const mailOptions = {
30-
from: env.EMAIL,
25+
from: 'clioanahi@gmail.com',
3126
to,
3227
subject,
3328
html: cleanHtml // Usamos la versión limpia

email-api/src/server.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
/*import app from './app.js'
2-
import { connectDB } from './db/connect.js'
3-
4-
const serverStart = async () => {
5-
try {
6-
await connectDB()
7-
app.listen(app.get('port'), () => {
8-
console.log(`Server running on port http://localhost:${app.get('port')}`)
9-
})
10-
} catch (error) {
11-
console.error('Error starting server:', error)
12-
process.exit(1)
13-
}
14-
}
15-
16-
serverStart()*/
17-
181
import app from './app.js'
192
// CAMBIO: Importamos el objeto sequelize por defecto (sin llaves)
203
import sequelize from './db/connect.js'

0 commit comments

Comments
 (0)