1
0
Fork 0
forked from svrjs/svrjs

Clone parsed JSON into process.serverConfig using deepClone() function

This commit is contained in:
Dorian Niemiec 2024-08-28 07:27:40 +02:00
parent 5bd369e38d
commit 17614dc6c7

View file

@ -216,6 +216,7 @@ const {
calculateBroadcastIPv4FromCidr,
} = require("./utils/ipSubnetUtils.js");
const sendStatistics = require("./utils/sendStatistics.js");
const deepClone = require("./utils/deepClone.js");
process.serverConfig = {};
let configJSONRErr = undefined;
@ -225,7 +226,7 @@ if (fs.existsSync(process.dirname + "/config.json")) {
try {
configJSONf = fs.readFileSync(process.dirname + "/config.json"); // Read JSON File
try {
process.serverConfig = Object.assign(Object.create(null), JSON.parse(configJSONf)); // Parse JSON and assign it to null prototype object
process.serverConfig = deepClone(JSON.parse(configJSONf)); // Parse JSON and deep clone to null prototype object
} catch (err2) {
configJSONPErr = err2;
}