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; 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));
} }

View file

@ -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;
} }

View file

@ -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 });
} }
}; };