Mailer & print config fix #257

This commit is contained in:
Joan Sanchez 2018-05-28 14:57:09 +02:00
parent 125c6dea37
commit b97eac4978
5 changed files with 328 additions and 252 deletions

View File

@ -1,7 +1,5 @@
FROM node:8.9.4 FROM node:8.9.4
RUN mkdir /nginx
COPY nginx/config.yml /nginx
COPY mailer /app COPY mailer /app
COPY loopback /loopback COPY loopback /loopback

View File

@ -12,9 +12,6 @@ module.exports = {
* Load mail config. * Load mail config.
*/ */
init: function() { init: function() {
if (process.env.NODE_ENV == 'test')
return;
this.transporter = nodemailer.createTransport(config.smtp); this.transporter = nodemailer.createTransport(config.smtp);
this.transporter.verify(function(error, success) { this.transporter.verify(function(error, success) {
@ -37,9 +34,6 @@ module.exports = {
* @param {Object} cb - Callback * @param {Object} cb - Callback
*/ */
send: function(recipient, subject, body, attachments, params, cb) { send: function(recipient, subject, body, attachments, params, cb) {
if (config.env == 'test')
return;
let mailOptions = { let mailOptions = {
from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>', from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>',
to: recipient, to: recipient,
@ -48,7 +42,7 @@ module.exports = {
attachments attachments
}; };
if (config.env == 'development') if (config.env != 'production')
mailOptions.to = config.app.senderMail; mailOptions.to = config.app.senderMail;
this.transporter.sendMail(mailOptions, (error, info) => { this.transporter.sendMail(mailOptions, (error, info) => {

View File

@ -1,7 +1,5 @@
FROM node:8.9.4 FROM node:8.9.4
RUN mkdir /nginx
COPY nginx/config.yml /nginx
COPY print /app COPY print /app
COPY loopback /loopback COPY loopback /loopback

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
"html-pdf": "^2.2.0", "html-pdf": "^2.2.0",
"inline-css": "^2.2.2", "inline-css": "^2.2.2",
"mustache": "^2.3.0", "mustache": "^2.3.0",
"mysql": "^2.13.0", "mysql2": "^1.5.3",
"path": "^0.12.7", "path": "^0.12.7",
"require-yaml": "0.0.1", "require-yaml": "0.0.1",
"strftime": "^0.10.0" "strftime": "^0.10.0"