From 203bc097a78851c8df1838abdf2582d13e582957 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 15 Sep 2021 18:10:13 +0200 Subject: [PATCH] Consistently name charging stations run on CF on multiple instances 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; } -- 2.34.1