refactor: make SMTP configuration configurable via environment variables
This commit is contained in:
parent
ad41ebe2a9
commit
f380a2cc41
@ -14,6 +14,10 @@ services:
|
||||
- EMAIL_PASSWORD=${EMAIL_PASSWORD}
|
||||
- DOMAIN=${DOMAIN}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
- SMTP_HOST=${SMTP_HOST}
|
||||
- SMTP_PORT=${SMTP_PORT}
|
||||
- SMTP_SECURE=${SMTP_SECURE}
|
||||
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- ./data:/usr/src/app/data
|
||||
|
||||
8
index.js
8
index.js
@ -443,15 +443,15 @@ app.get('/location/:id', async (req, res) => {
|
||||
|
||||
// Configure nodemailer with your own server
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'mail.uplink.tel', // Replace with your SMTP server
|
||||
port: 465, // Replace with your SMTP port (587 is common for TLS)
|
||||
secure: true, // Set to true if using port 465
|
||||
host: process.env.SMTP_HOST || 'mail.uplink.tel',
|
||||
port: parseInt(process.env.SMTP_PORT, 10) || 465,
|
||||
secure: (process.env.SMTP_SECURE || 'true').toLowerCase() === 'true',
|
||||
auth: {
|
||||
user: process.env.ADMIN_EMAIL, // Admin email
|
||||
pass: process.env.EMAIL_PASSWORD // Email password
|
||||
},
|
||||
tls: {
|
||||
rejectUnauthorized: false // Use this if you encounter certificate issues
|
||||
rejectUnauthorized: (process.env.SMTP_TLS_REJECT_UNAUTHORIZED || 'false').toLowerCase() === 'true' // Default to false for rejectUnauthorized
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user