From: Jérôme Benoit Date: Sun, 11 Jun 2023 16:24:55 +0000 (+0200) Subject: fix: properly handle non existing configuration sections X-Git-Tag: v1.2.17~29 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=25baaaf241b827786fd7c11a77c9a0f3431608d0;p=e-mobility-charging-stations-simulator.git fix: properly handle non existing configuration sections Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 15a7bf08..b54f3900 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -234,7 +234,7 @@ export class Configuration { const logConfiguration: LogConfiguration = { ...defaultLogConfiguration, ...deprecatedLogConfiguration, - ...Configuration.getConfig()?.log, + ...(Utils.hasOwnProp(Configuration.getConfig(), 'log') && Configuration.getConfig()?.log), }; return logConfiguration; } @@ -321,7 +321,8 @@ export class Configuration { const workerConfiguration: WorkerConfiguration = { ...defaultWorkerConfiguration, ...deprecatedWorkerConfiguration, - ...Configuration.getConfig()?.worker, + ...(Utils.hasOwnProp(Configuration.getConfig(), 'worker') && + Configuration.getConfig()?.worker), }; return workerConfiguration; }