Ensure configuration key have default settings values
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStation.ts
index bd3557717e273e7fa75acd65a0c562452cb8ec53..90b788a68b83235e599c843139ef79406a610bb9 100644 (file)
@@ -80,10 +80,10 @@ export default class ChargingStation {
   public performanceStatistics!: PerformanceStatistics;
   public heartbeatSetInterval!: NodeJS.Timeout;
   public ocppRequestService!: OCPPRequestService;
+  public bootNotificationResponse!: BootNotificationResponse | null;
   private readonly index: number;
   private configurationFile!: string;
   private bootNotificationRequest!: BootNotificationRequest;
-  private bootNotificationResponse!: BootNotificationResponse | null;
   private connectorsConfigurationHash!: string;
   private ocppIncomingRequestService!: OCPPIncomingRequestService;
   private readonly messageBuffer: Set<string>;
@@ -632,9 +632,9 @@ export default class ChargingStation {
         reboot: false,
       };
     }
-    const readonly = options.readonly;
-    const visible = options.visible;
-    const reboot = options.reboot;
+    const readonly = options.readonly ?? false;
+    const visible = options.visible ?? true;
+    const reboot = options.reboot ?? false;
     let keyFound = this.getConfigurationKey(key);
     if (keyFound && params?.overwrite) {
       this.deleteConfigurationKey(keyFound.key, { save: false });