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

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-04-15 18:46:40 +01:00
parent 1dca9e2235
commit 7b8cf85740
1 changed files with 1 additions and 1 deletions

View File

@ -1117,7 +1117,7 @@ function performConfigOperations(args) {
if (fs.existsSync(configFile) == false) { console.log("Unable to find config.json."); return; }
var config = null;
try { config = fs.readFileSync(configFile).toString('utf8'); } catch (ex) { console.log("Error: Unable to read config.json"); return; }
try { config = require(configFile); } catch (e) { console.log('ERROR: Unable to parse ' + configFile + '.'); return null; }
try { config = JSON.parse(fs.readFileSync(configFile)) } catch (e) { console.log('ERROR: Unable to parse ' + configFile + '.'); return null; }
if (args.adddomain != null) {
didSomething++;
if (config.domains == null) { config.domains = {}; }