diff --git a/lib/app.js b/lib/app.js index 492217e72..fd3dc21fd 100644 --- a/lib/app.js +++ b/lib/app.js @@ -19,15 +19,21 @@ const initAndReport = (app, method = 'start') => { /* * Helper to load in all app plugins */ -const loadPlugins = (app, lando) => Promise.resolve(app.plugins.registry) -// Filter out - .filter(plugin => _.has(plugin, 'app')) -// LOADEM! - .map(plugin => app.plugins.load(plugin, plugin.app, app, lando)) -// Remove any naughty shit - .map(plugin => _.pick(plugin.data, ['config', 'composeData', 'env', 'labels'])) -// Merge minotaur - .each(result => _.merge(app, result)); +const loadPlugins = (app, lando) => { + app.appPlugins = []; + return Promise.resolve(app.plugins.registry) + // Filter out + .filter(plugin => _.has(plugin, 'app')) + // LOADEM! + .map(plugin => app.plugins.load(plugin, plugin.app, app, lando)) + // Remove any naughty shit + .map(plugin => { + app.appPlugins.push(plugin); + return _.pick(plugin.data, ['config', 'composeData', 'env', 'labels']); + }) + // Merge minotaur + .each(result => _.merge(app, result)); +}; /** * The class to instantiate a new App diff --git a/lib/events.js b/lib/events.js index 49ddf7c89..6da530b68 100644 --- a/lib/events.js +++ b/lib/events.js @@ -108,6 +108,6 @@ class AsyncEvents extends EventEmitter { }; // Set our maxListeners to something more reasonable for lando -AsyncEvents.prototype.setMaxListeners(Infinity); +AsyncEvents.prototype.setMaxListeners(128); module.exports = AsyncEvents; diff --git a/lib/plugins.js b/lib/plugins.js index ba7632962..979c9513e 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -116,9 +116,11 @@ module.exports = class Plugins { } // Register, log, return - this.registry.push(plugin); - this.log.debug('plugin %s loaded from %s', plugin.name, file); - this.log.silly('plugin %s has', plugin.name, plugin.data); + if (!this.registry.find(p => p.name === plugin.name)) { + this.registry.push(plugin); + this.log.debug('plugin %s loaded from %s', plugin.name, file); + this.log.silly('plugin %s has', plugin.name, plugin.data); + } return plugin; }; };