wildduck/lib/plugins.js

30 lines
724 B
JavaScript
Raw Permalink Normal View History

2017-10-26 15:21:32 +08:00
'use strict';
const config = require('wild-config');
2017-10-26 19:57:19 +08:00
const log = require('npmlog');
const PluginHandler = require('zone-mta/lib/plugin-handler');
2017-10-26 19:57:19 +08:00
const db = require('./db');
2017-10-26 15:21:32 +08:00
2022-07-19 14:22:46 +08:00
module.exports.handler = {
// dummy handler
runHooks(...args) {
if (args.length && typeof args[args.length - 1] === 'function') {
args[args.length - 1]();
}
// assume promise
return new Promise(resolve => setImmediate(resolve));
}
};
module.exports.init = context => {
module.exports.handler = new PluginHandler({
logger: log,
pluginsPath: config.plugins.pluginsPath,
plugins: config.plugins.conf,
context,
log: config.log,
db
});
2017-10-26 15:21:32 +08:00
};