Merge pull request #4650 from spalger/fix/pluginConfigWarning
[config/plugins] move plugin config setup to prevent invalid warning
This commit is contained in:
commit
71754df94c
3 changed files with 3 additions and 3 deletions
|
@ -13,7 +13,7 @@ module.exports = class Plugins extends Collection {
|
||||||
this.kbnServer = kbnServer;
|
this.kbnServer = kbnServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
new(path) {
|
async new(path) {
|
||||||
var api = new PluginApi(this.kbnServer, path);
|
var api = new PluginApi(this.kbnServer, path);
|
||||||
let output = [].concat(require(path)(api) || []);
|
let output = [].concat(require(path)(api) || []);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ module.exports = class Plugins extends Collection {
|
||||||
if (product instanceof api.Plugin) {
|
if (product instanceof api.Plugin) {
|
||||||
this[byIdCache] = null;
|
this[byIdCache] = null;
|
||||||
this.add(product);
|
this.add(product);
|
||||||
|
await product.setupConfig();
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError('unexpected plugin export ' + inspect(product));
|
throw new TypeError('unexpected plugin export ' + inspect(product));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ module.exports = async function (kbnServer, server, config) {
|
||||||
|
|
||||||
// setup config and filter out disabled plugins
|
// setup config and filter out disabled plugins
|
||||||
for (let plugin of plugins) {
|
for (let plugin of plugins) {
|
||||||
await plugin.setupConfig();
|
|
||||||
if (config.get([plugin.id, 'enabled'])) {
|
if (config.get([plugin.id, 'enabled'])) {
|
||||||
enabledPlugins[plugin.id] = plugin;
|
enabledPlugins[plugin.id] = plugin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = async (kbnServer, server, config) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
require(modulePath);
|
require(modulePath);
|
||||||
plugins.new(path);
|
await plugins.new(path);
|
||||||
debug({ tmpl: 'Found plugin at <%= path %>', path: modulePath });
|
debug({ tmpl: 'Found plugin at <%= path %>', path: modulePath });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue