dont require, use readFileSync and phase for config.json in meshctrl #6029

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Apr 15, 2024 at 18:46 UTC 7b8cf857405d370add2501d0a8c2b440d6f018cd
1 file changed +1 -1
meshctrl.js
+1 -1
@@ -1117,7 +1117,7 @@ function performConfigOperations(args) {
1117 if (fs.existsSync(configFile) == false) { console.log("Unable to find config.json."); return; }
1118 var config = null;
1119 try { config = fs.readFileSync(configFile).toString('utf8'); } catch (ex) { console.log("Error: Unable to read config.json"); return; }
1120 - try { config = require(configFile); } catch (e) { console.log('ERROR: Unable to parse ' + configFile + '.'); return null; }
1120 + try { config = JSON.parse(fs.readFileSync(configFile)) } catch (e) { console.log('ERROR: Unable to parse ' + configFile + '.'); return null; }
1121 if (args.adddomain != null) {
1122 didSomething++;
1123 if (config.domains == null) { config.domains = {}; }