Add SMTP transporter in helpers
This commit is contained in:
parent
2b4832a4f7
commit
a197ae9cc6
@ -1,13 +1,18 @@
|
||||
module.exports = {
|
||||
// from '.env' in root folder
|
||||
module.exports = {
|
||||
// APP
|
||||
port: process.env.PORT || 3001,
|
||||
environment: process.env.NODE_ENV || 'development',
|
||||
// DATABASE
|
||||
dbURL: process.env.DATABASE_URL,
|
||||
// JWT
|
||||
jwtSecret: process.env.JWT_SECRET,
|
||||
saltingRounds: process.env.SALTING_ROUNDS || 10,
|
||||
// NODEMAILER
|
||||
smtpHost: process.env.SMTP_HOST,
|
||||
smtpPort: process.env.SMTP_PORT,
|
||||
smtpUsername: process.env.SMTP_USERNAME,
|
||||
smtpPassword: process.env.SMTP_PASSWORD,
|
||||
// Others
|
||||
saltingRounds: process.env.SALTING_ROUNDS || 10,
|
||||
smtpSecure: process.env.SMTP_SECURE || true, // use TLS
|
||||
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