From 17614dc6c7761f24485a452da728d8fda4821d13 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Wed, 28 Aug 2024 07:27:40 +0200 Subject: [PATCH] Clone parsed JSON into process.serverConfig using deepClone() function --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a73c3bf..41b8452 100644 --- a/src/index.js +++ b/src/index.js @@ -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; }