Skip to content

Commit

Permalink
Resolving unused settings bug when plugin is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb committed Feb 6, 2017
1 parent 909b8c7 commit c829139
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 35 deletions.
19 changes: 0 additions & 19 deletions src/server/config/__tests__/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,5 @@ describe('lib/config/config', function () {
});

});

describe('#removeSchema(key)', function () {
it('should completely remove the key', function () {
const config = new Config(Joi.object().keys({
a: Joi.number().default(1)
}));

expect(config.get('a')).to.be(1);
config.removeSchema('a');
expect(() => config.get('a')).to.throwException('Unknown config key');
});

it('only removes existing keys', function () {
const config = new Config(Joi.object());

expect(() => config.removeSchema('b')).to.throwException('Unknown schema');
});
});

});
});
10 changes: 0 additions & 10 deletions src/server/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ module.exports = class Config {
this.set(key, settings);
}

removeSchema(key) {
if (!_.has(this[schemaExts], key)) {
throw new TypeError(`Unknown schema key: ${key}`);
}

this[schema] = null;
unset(this[schemaExts], key);
unset(this[vals], key);
}

resetTo(obj) {
this._commit(obj);
}
Expand Down
6 changes: 0 additions & 6 deletions src/server/plugins/plugin_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ async function addPluginConfig(pluginCollection, plugin) {
config.extendSchema(configSchema, transformedPluginSettings, plugin.configPrefix);
}

function removePluginConfig(pluginCollection, plugin) {
const { config } = pluginCollection.kbnServer;
config.removeSchema(plugin.configPrefix);
}

module.exports = class Plugins extends Collection {

constructor(kbnServer) {
Expand Down Expand Up @@ -60,7 +55,6 @@ module.exports = class Plugins extends Collection {
}

async disable(plugin) {
removePluginConfig(this, plugin);
this.delete(plugin);
}

Expand Down

0 comments on commit c829139

Please sign in to comment.