allow debug from config

allow debug to be set from config at config.settings.debug as with same options as argument

mstrhakr committed Sep 5, 2022 at 21:44 UTC c4fb0c23e15c5a9fadbb38ef9b014c28a14e10ae
1 file changed +7 -3
meshcentral.js
+7 -3
@@ -796,9 +796,13 @@ function CreateMeshCentralServer(config, args) {
796 }
797
798 // Local console tracing
799 - if (typeof obj.args.debug == 'string') { obj.debugSources = obj.args.debug.toLowerCase().split(','); }
800 - else if (typeof obj.args.debug == 'object') { obj.debugSources = obj.args.debug; }
801 - else if (obj.args.debug === true) { obj.debugSources = '*'; }
799 + var debugOptions = [obj.args.debug];
800 + if (config.settings.debug) { debugOptions.push(config.settings.debug) }
801 + debugOptions.forEach((option) => {
802 + if (typeof option == 'string') { obj.debugSources = option.toLowerCase().split(','); }
803 + else if (typeof option == 'object') { obj.debugSources = option; }
804 + else if (option === true) { obj.debugSources = '*'; }
805 + });
806
807 require('./db.js').CreateDB(obj,
808 function (db) {