Skip to content

Commit 479e5bc

Browse files
authored
fix(pluginhandler): ZMS-269: plugins - use wild-plugins, update options, allow for dynamic config (#886)
* plugins - use wild-plugins, update options, allow for dynamic config * wild-plugins update deps, use scoped package * update deps
1 parent 6e4b701 commit 479e5bc

File tree

3 files changed

+2037
-9883
lines changed

3 files changed

+2037
-9883
lines changed

lib/plugins.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const config = require('wild-config');
44
const log = require('npmlog');
5-
const PluginHandler = require('zone-mta/lib/plugin-handler');
5+
const PluginHandler = require('@zone-eu/wild-plugins');
66
const db = require('./db');
77

88
module.exports.handler = {
@@ -17,13 +17,20 @@ module.exports.handler = {
1717
}
1818
};
1919

20-
module.exports.init = context => {
20+
module.exports.init = opts => {
21+
let context;
22+
23+
if (typeof opts === 'string') {
24+
context = opts;
25+
}
26+
context = opts.context;
27+
2128
module.exports.handler = new PluginHandler({
2229
logger: log,
23-
pluginsPath: config.plugins.pluginsPath,
24-
plugins: config.plugins.conf,
30+
pluginsPath: opts.config?.plugins?.pluginsPath || config.plugins.pluginsPath,
31+
plugins: opts.config?.plugins?.conf || config.plugins.conf,
2532
context,
26-
log: config.log,
33+
log: opts.config?.log || config.log,
2734
db
2835
});
2936
};

0 commit comments

Comments
 (0)