Merge pull request #4650 from spalger/fix/pluginConfigWarning

[config/plugins] move plugin config setup to prevent invalid warning
This commit is contained in:
Joe Fleming 2015-08-12 11:39:22 -07:00
commit 71754df94c
3 changed files with 3 additions and 3 deletions

View file

@ -13,7 +13,7 @@ module.exports = class Plugins extends Collection {
this.kbnServer = kbnServer;
}
new(path) {
async new(path) {
var api = new PluginApi(this.kbnServer, path);
let output = [].concat(require(path)(api) || []);
@ -21,6 +21,7 @@ module.exports = class Plugins extends Collection {
if (product instanceof api.Plugin) {
this[byIdCache] = null;
this.add(product);
await product.setupConfig();
} else {
throw new TypeError('unexpected plugin export ' + inspect(product));
}

View file

@ -11,7 +11,6 @@ module.exports = async function (kbnServer, server, config) {
// setup config and filter out disabled plugins
for (let plugin of plugins) {
await plugin.setupConfig();
if (config.get([plugin.id, 'enabled'])) {
enabledPlugins[plugin.id] = plugin;
}

View file

@ -54,7 +54,7 @@ module.exports = async (kbnServer, server, config) => {
}
require(modulePath);
plugins.new(path);
await plugins.new(path);
debug({ tmpl: 'Found plugin at <%= path %>', path: modulePath });
}
};