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}
|
- EMAIL_PASSWORD=${EMAIL_PASSWORD}
|
||||||
- DOMAIN=${DOMAIN}
|
- DOMAIN=${DOMAIN}
|
||||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
- 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:
|
volumes:
|
||||||
- .:/usr/src/app
|
- .:/usr/src/app
|
||||||
- ./data:/usr/src/app/data
|
- ./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
|
// Configure nodemailer with your own server
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host: 'mail.uplink.tel', // Replace with your SMTP server
|
host: process.env.SMTP_HOST || 'mail.uplink.tel',
|
||||||
port: 465, // Replace with your SMTP port (587 is common for TLS)
|
port: parseInt(process.env.SMTP_PORT, 10) || 465,
|
||||||
secure: true, // Set to true if using port 465
|
secure: (process.env.SMTP_SECURE || 'true').toLowerCase() === 'true',
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.ADMIN_EMAIL, // Admin email
|
user: process.env.ADMIN_EMAIL, // Admin email
|
||||||
pass: process.env.EMAIL_PASSWORD // Email password
|
pass: process.env.EMAIL_PASSWORD // Email password
|
||||||
},
|
},
|
||||||
tls: {
|
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