From 78786898ff255379a312fc2d9724515b9219b27c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 23 Nov 2023 21:25:48 +0100 Subject: [PATCH] fix: fix configuration loading from file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 3e1917a1..610c2d54 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1132,9 +1132,11 @@ export class ChargingStation extends EventEmitter { return stationInfo; } - private getStationInfoFromFile(): ChargingStationInfo | undefined { + private getStationInfoFromFile( + stationInfoPersistentConfiguration: boolean, + ): ChargingStationInfo | undefined { let stationInfo: ChargingStationInfo | undefined; - if (this.stationInfo?.stationInfoPersistentConfiguration === true) { + if (stationInfoPersistentConfiguration === true) { stationInfo = this.getConfigurationFromFile()?.stationInfo; if (stationInfo) { delete stationInfo?.infoHash; @@ -1168,7 +1170,9 @@ export class ChargingStation extends EventEmitter { stopTransactionsOnStopped: true, }; const stationInfoFromTemplate: ChargingStationInfo = this.getStationInfoFromTemplate(); - const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile(); + const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile( + stationInfoFromTemplate?.stationInfoPersistentConfiguration ?? true, + ); // Priority: // 1. charging station info from template // 2. charging station info from configuration file -- 2.34.1