Implement new configuration system

Replace current configuration mess with a trimmed down version of the
original vision of #200.  Configs are collection of config groups that
have fields that can be set.  These groups allow organizing the fields
as well as opertunity for plugins to add their own groups.  By default
plugins have an auto generated group with the enabled field.
This commit is contained in:
Hornwitser committed 2020-03-09 20:48:13 +01:00
1 parent 370ee9ed04
commit 5e5149dc93
24 files changed
+2364 -498

No files matched your search

+11 -3
View File
@@ -106,7 +106,16 @@ class BaseMasterPlugin {
async onExit() { }
}
async function getPluginInfos(baseDir) {
/**
* Load plugin information
*
* Searches through the plugin directory and loads each plugin's info
* module. Once loaded the info modules will not be reloaded should this
* function be called again.
*
* @returns {Map<string, Object>} mapping of plugin name to info module.
*/
async function loadPluginInfos(baseDir) {
let plugins = [];
for (let pluginDir of await fs.readdir(baseDir)) {
let pluginInfo;
@@ -129,7 +138,6 @@ async function getPluginInfos(baseDir) {
);
}
pluginInfo.enabled = !await fs.exists(path.join(baseDir, pluginDir, "DISABLED"));
plugins.push(pluginInfo);
}
return plugins;
@@ -155,6 +163,6 @@ module.exports = {
BaseInstancePlugin,
BaseMasterPlugin,
getPluginInfos,
loadPluginInfos,
attachPluginMessages,
};