From: Jérôme Benoit Date: Wed, 15 Sep 2021 16:10:13 +0000 (+0200) Subject: Consistently name charging stations run on CF on multiple instances X-Git-Tag: v1.1.0~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=203bc097a78851c8df1838abdf2582d13e582957;p=e-mobility-charging-stations-simulator.git Consistently name charging stations run on CF on multiple instances Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 8c7d2d1e..67bf3b62 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -435,8 +435,7 @@ export default class ChargingStation { private getChargingStationId(stationTemplate: ChargingStationTemplate): string { // In case of multiple instances: add instance index to charging station id - let instanceIndex = process.env.CF_INSTANCE_INDEX ?? 0; - instanceIndex = instanceIndex > 0 ? instanceIndex : ''; + const instanceIndex = process.env.CF_INSTANCE_INDEX ?? 0; const idSuffix = stationTemplate.nameSuffix ?? ''; return stationTemplate.fixedName ? stationTemplate.baseName : stationTemplate.baseName + '-' + instanceIndex.toString() + ('000000000' + this.index.toString()).substr(('000000000' + this.index.toString()).length - 4) + idSuffix; }