Skip to content

Commit

Permalink
Do not use an object for SMTP options
Browse files Browse the repository at this point in the history
Objects do not appear to work when supplying ecosystem config options,
so move the two SMTP options into their own lines in the config
  • Loading branch information
Andrew Isherwood committed Dec 3, 2020
1 parent fe3454c commit b88c707
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
14 changes: 4 additions & 10 deletions ecosystem.config.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ module.exports = {
BASE_URL: '<base_url_of_frontend>',
FROM: '<email_from>',
REPLY_TO: '<email_reply_to>',
// See https://nodemailer.com/smtp/ for all options
SMTP_OPTIONS: {
port: '<smtp_port>',
host: '<smtp_server>'
}
SMTP_HOST: '<smtp_host>',
SMTP_PORT: '<smtp_port>'
},
env_production: {
NODE_ENV: 'production',
Expand All @@ -31,11 +28,8 @@ module.exports = {
BASE_URL: '<base_url_of_frontend>'
FROM: '<email_from>',
REPLY_TO: '<email_reply_to>',
// See https://nodemailer.com/smtp/ for all options
SMTP_OPTIONS: {
port: '<smtp_port>',
host: '<smtp_server>'
}
SMTP_HOST: '<smtp_host>',
SMTP_PORT: '<smtp_port>'
}
}
]
Expand Down
7 changes: 5 additions & 2 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ const nodemailer = require('nodemailer');
const db = require('../ems-db');

const email = new Email();
let smtpOptions = JSON.parse(process.env.SMTP_OPTIONS);
smtpOptions = {...smtpOptions, send: true};
const smtpOptions = {
send: true,
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT
};
const transporter = nodemailer.createTransport(smtpOptions);

const sendEmail = async ({to, name, queries, type}) => {
Expand Down

0 comments on commit b88c707

Please sign in to comment.