forked from svrjs/svrjs
Clone parsed JSON into process.serverConfig using deepClone() function
This commit is contained in:
parent
5bd369e38d
commit
17614dc6c7
1 changed files with 2 additions and 1 deletions
|
@ -216,6 +216,7 @@ const {
|
||||||
calculateBroadcastIPv4FromCidr,
|
calculateBroadcastIPv4FromCidr,
|
||||||
} = require("./utils/ipSubnetUtils.js");
|
} = require("./utils/ipSubnetUtils.js");
|
||||||
const sendStatistics = require("./utils/sendStatistics.js");
|
const sendStatistics = require("./utils/sendStatistics.js");
|
||||||
|
const deepClone = require("./utils/deepClone.js");
|
||||||
|
|
||||||
process.serverConfig = {};
|
process.serverConfig = {};
|
||||||
let configJSONRErr = undefined;
|
let configJSONRErr = undefined;
|
||||||
|
@ -225,7 +226,7 @@ if (fs.existsSync(process.dirname + "/config.json")) {
|
||||||
try {
|
try {
|
||||||
configJSONf = fs.readFileSync(process.dirname + "/config.json"); // Read JSON File
|
configJSONf = fs.readFileSync(process.dirname + "/config.json"); // Read JSON File
|
||||||
try {
|
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) {
|
} catch (err2) {
|
||||||
configJSONPErr = err2;
|
configJSONPErr = err2;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue