|
|
|
|
@ -34,20 +34,19 @@ if (Object.keys(mongoConnectionOptions).length > 0) { |
|
|
|
|
|
|
|
|
|
process.env.HTTP_FORWARDED_COUNT = process.env.HTTP_FORWARDED_COUNT || '1'; |
|
|
|
|
|
|
|
|
|
// Send emails to a "fake" stream instead of print them in console in case MAIL_URL or SMTP is not configured
|
|
|
|
|
if (process.env.NODE_ENV !== 'development') { |
|
|
|
|
const { sendAsync } = Email; |
|
|
|
|
// Just print to logs if in TEST_MODE due to a bug in Meteor 2.5: TypeError: Cannot read property '_syncSendMail' of null
|
|
|
|
|
if (process.env.TEST_MODE === 'true') { |
|
|
|
|
Email.sendAsync = function _sendAsync(options) { |
|
|
|
|
console.log('Email.sendAsync', options); |
|
|
|
|
}; |
|
|
|
|
} else if (process.env.NODE_ENV !== 'development') { |
|
|
|
|
// Send emails to a "fake" stream instead of print them in console in case MAIL_URL or SMTP is not configured
|
|
|
|
|
const stream = new PassThrough(); |
|
|
|
|
stream.on('data', () => {}); |
|
|
|
|
stream.on('end', () => {}); |
|
|
|
|
Email.sendAsync = function _sendAsync(options) { |
|
|
|
|
return sendAsync.call(this, { stream, ...options }); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Just print to logs if in TEST_MODE due to a bug in Meteor 2.5: TypeError: Cannot read property '_syncSendMail' of null
|
|
|
|
|
if (process.env.TEST_MODE === 'true') { |
|
|
|
|
const { sendAsync } = Email; |
|
|
|
|
Email.sendAsync = function _sendAsync(options) { |
|
|
|
|
console.log('Email.sendAsync', options); |
|
|
|
|
return sendAsync.call(this, { stream, ...options }); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|