mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-27 15:45:53 -05:00
Add error catching in case the user doesn't have the config options set.
This commit is contained in:
parent
9e9bbfad62
commit
4f05936d75
@ -21,11 +21,18 @@ module.exports.pluginHandler = function (parent) {
|
|||||||
obj.path = require('path');
|
obj.path = require('path');
|
||||||
obj.parent = parent;
|
obj.parent = parent;
|
||||||
obj.pluginPath = obj.parent.path.join(obj.parent.datapath, 'plugins');
|
obj.pluginPath = obj.parent.path.join(obj.parent.datapath, 'plugins');
|
||||||
obj.enabled = obj.parent.config.settings.plugins.enabled;
|
|
||||||
obj.loadList = obj.parent.config.settings.plugins.list;
|
|
||||||
obj.plugins = {};
|
obj.plugins = {};
|
||||||
obj.exports = {};
|
obj.exports = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
obj.enabled = obj.parent.config.settings.plugins.enabled;
|
||||||
|
obj.loadList = obj.parent.config.settings.plugins.list;
|
||||||
|
} catch (e) { // Config file options not present, disable self
|
||||||
|
obj.enabled = false;
|
||||||
|
obj.loadList = {};
|
||||||
|
console.log('Plugin options not added to the config file. Plugins disabled. Please see the documentation.');
|
||||||
|
}
|
||||||
|
|
||||||
if (obj.enabled) {
|
if (obj.enabled) {
|
||||||
obj.loadList.forEach(function(plugin, index) {
|
obj.loadList.forEach(function(plugin, index) {
|
||||||
if (obj.fs.existsSync(obj.pluginPath + '/' + plugin)) {
|
if (obj.fs.existsSync(obj.pluginPath + '/' + plugin)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user