Fix exit conditions at startup
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 24 Aug 2022 20:36:24 +0000 (22:36 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 24 Aug 2022 20:36:24 +0000 (22:36 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/Bootstrap.ts

index 2bc650cc32ec9116f638b33da3eb1d4e4a361d21..80e14d151bef4897d4f4ec541e967529572d2003 100644 (file)
@@ -32,6 +32,9 @@ import UIServerFactory from './ui-server/UIServerFactory';
 
 const moduleName = 'Bootstrap';
 
+const missingChargingStationsConfigurationExitCode = 1;
+const noChargingStationTemplatesExitCode = 2;
+
 export default class Bootstrap {
   private static instance: Bootstrap | null = null;
   private workerImplementation: WorkerAbstract<ChargingStationWorkerData> | null = null;
@@ -105,12 +108,13 @@ export default class Bootstrap {
           console.warn(
             chalk.yellow("'stationTemplateUrls' not defined or empty in configuration, exiting")
           );
+          process.exit(missingChargingStationsConfigurationExitCode);
         }
         if (this.numberOfChargingStations === 0) {
           console.warn(
             chalk.yellow('No charging station template enabled in configuration, exiting')
           );
-          process.exit();
+          process.exit(noChargingStationTemplatesExitCode);
         } else {
           console.info(
             chalk.green(