waigo
Version:
Node.js ES6 framework for reactive, data-driven apps and APIs (Koa, RethinkDB)
32 lines (21 loc) • 583 B
JavaScript
;
const waigo = global.waigo,
_ = waigo._;
/**
* Setup emailer system.
*
* Upon completion:
*
* * `App.mailer` will be the emailer interface.
*
* @param {Object} App The application.
*/
module.exports = function*(App) {
let mailerConfig = _.get(App.config, 'mailer', {});
if (!_.get(mailerConfig, 'type')) {
throw new Error('Mailer type not set');
}
App.logger.debug(`Initializing mailer: ${mailerConfig.type}`);
let mailer = waigo.load(`support/mailer/${mailerConfig.type}`);
App.mailer = yield mailer.create(App, mailerConfig);
};