Add SMTP transporter in helpers
This commit is contained in:
parent
2b4832a4f7
commit
a197ae9cc6
@ -1,13 +1,18 @@
|
|||||||
|
// from '.env' in root folder
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// from '.env' in root folder
|
// APP
|
||||||
port: process.env.PORT || 3001,
|
port: process.env.PORT || 3001,
|
||||||
environment: process.env.NODE_ENV || 'development',
|
environment: process.env.NODE_ENV || 'development',
|
||||||
|
// DATABASE
|
||||||
dbURL: process.env.DATABASE_URL,
|
dbURL: process.env.DATABASE_URL,
|
||||||
|
// JWT
|
||||||
jwtSecret: process.env.JWT_SECRET,
|
jwtSecret: process.env.JWT_SECRET,
|
||||||
|
saltingRounds: process.env.SALTING_ROUNDS || 10,
|
||||||
|
// NODEMAILER
|
||||||
smtpHost: process.env.SMTP_HOST,
|
smtpHost: process.env.SMTP_HOST,
|
||||||
smtpPort: process.env.SMTP_PORT,
|
smtpPort: process.env.SMTP_PORT,
|
||||||
smtpUsername: process.env.SMTP_USERNAME,
|
smtpUsername: process.env.SMTP_USERNAME,
|
||||||
smtpPassword: process.env.SMTP_PASSWORD,
|
smtpPassword: process.env.SMTP_PASSWORD,
|
||||||
// Others
|
smtpSecure: process.env.SMTP_SECURE || true, // use TLS
|
||||||
saltingRounds: process.env.SALTING_ROUNDS || 10,
|
smtpPool: process.env.SMTP_POOL|| true, // Pool connections to server
|
||||||
};
|
};
|
||||||
|
20
helpers/smtpTransporter.js
Normal file
20
helpers/smtpTransporter.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const nodemailer = require('nodemailer');
|
||||||
|
|
||||||
|
const {
|
||||||
|
smtpPool,
|
||||||
|
smtpHost,
|
||||||
|
smtpPort,
|
||||||
|
smtpUsername,
|
||||||
|
smtpPassword,
|
||||||
|
} = require('../config/config');
|
||||||
|
|
||||||
|
nodemailer.createTransport({
|
||||||
|
pool: smtpPool,
|
||||||
|
host: smtpHost,
|
||||||
|
port: smtpPort,
|
||||||
|
secure: smtpSecure,
|
||||||
|
auth: {
|
||||||
|
user: smtpUsername,
|
||||||
|
pass: smtpPassword,
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user