From: Jérôme Benoit Date: Thu, 23 Nov 2023 20:25:48 +0000 (+0100) Subject: fix: fix configuration loading from file X-Git-Tag: v1.2.26~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=78786898ff255379a312fc2d9724515b9219b27c;p=e-mobility-charging-stations-simulator.git fix: fix configuration loading from file Signed-off-by: Jérôme Benoit --- 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