import chalk from 'chalk';
-import { ChargingStationUtils } from './ChargingStationUtils';
import type { AbstractUIServer } from './ui-server/AbstractUIServer';
import { UIServerFactory } from './ui-server/UIServerFactory';
import packageJson from '../../package.json' assert { type: 'json' };
`Charging stations simulator ${
this.version
} started with ${this.numberOfChargingStations.toString()} charging station(s) from ${this.numberOfChargingStationTemplates.toString()} configured charging station template(s) and ${
- ChargingStationUtils.workerDynamicPoolInUse()
+ Configuration.workerDynamicPoolInUse()
? `${Configuration.getWorker().poolMinSize?.toString()}/`
: ''
}${this.workerImplementation?.size}${
- ChargingStationUtils.workerPoolInUse()
+ Configuration.workerPoolInUse()
? `/${Configuration.getWorker().poolMaxSize?.toString()}`
: ''
} worker(s) concurrently running in '${Configuration.getWorker().processType}' mode${
// This is intentional
}
- static setConfigurationChangeCallback(cb: () => Promise<void>): void {
+ public static setConfigurationChangeCallback(cb: () => Promise<void>): void {
Configuration.configurationChangeCallback = cb;
}
- static getLogStatisticsInterval(): number | undefined {
+ public static getLogStatisticsInterval(): number | undefined {
Configuration.warnDeprecatedConfigurationKey(
'statisticsDisplayInterval',
undefined,
: Constants.DEFAULT_LOG_STATISTICS_INTERVAL;
}
- static getUIServer(): UIServerConfiguration {
+ public static getUIServer(): UIServerConfiguration {
if (Utils.hasOwnProp(Configuration.getConfig(), 'uiWebSocketServer')) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration section 'uiWebSocketServer' usage. Use 'uiServer' instead}`
return uiServerConfiguration;
}
- static getPerformanceStorage(): StorageConfiguration {
+ public static getPerformanceStorage(): StorageConfiguration {
Configuration.warnDeprecatedConfigurationKey('URI', 'performanceStorage', "Use 'uri' instead");
let storageConfiguration: StorageConfiguration = {
enabled: false,
return storageConfiguration;
}
- static getAutoReconnectMaxRetries(): number | undefined {
+ public static getAutoReconnectMaxRetries(): number | undefined {
Configuration.warnDeprecatedConfigurationKey(
'autoReconnectTimeout',
undefined,
}
}
- static getStationTemplateUrls(): StationTemplateUrl[] | undefined {
+ public static getStationTemplateUrls(): StationTemplateUrl[] | undefined {
Configuration.warnDeprecatedConfigurationKey(
'stationTemplateURLs',
undefined,
return Configuration.getConfig()?.stationTemplateUrls;
}
- static getWorker(): WorkerConfiguration {
+ public static getWorker(): WorkerConfiguration {
Configuration.warnDeprecatedConfigurationKey(
'useWorkerPool',
undefined,
return workerConfiguration;
}
- static getLogConsole(): boolean | undefined {
+ public static workerPoolInUse(): boolean {
+ return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes(
+ Configuration.getWorker().processType
+ );
+ }
+
+ public static workerDynamicPoolInUse(): boolean {
+ return Configuration.getWorker().processType === WorkerProcessType.dynamicPool;
+ }
+
+ public static getLogConsole(): boolean | undefined {
Configuration.warnDeprecatedConfigurationKey(
'consoleLog',
undefined,
: false;
}
- static getLogFormat(): string | undefined {
+ public static getLogFormat(): string | undefined {
return Utils.hasOwnProp(Configuration.getConfig(), 'logFormat')
? Configuration.getConfig()?.logFormat
: 'simple';
}
- static getLogRotate(): boolean | undefined {
+ public static getLogRotate(): boolean | undefined {
return Utils.hasOwnProp(Configuration.getConfig(), 'logRotate')
? Configuration.getConfig()?.logRotate
: true;
}
- static getLogMaxFiles(): number | string | false | undefined {
+ public static getLogMaxFiles(): number | string | false | undefined {
return (
Utils.hasOwnProp(Configuration.getConfig(), 'logMaxFiles') &&
Configuration.getConfig()?.logMaxFiles
);
}
- static getLogMaxSize(): number | string | false | undefined {
+ public static getLogMaxSize(): number | string | false | undefined {
return (
Utils.hasOwnProp(Configuration.getConfig(), 'logMaxFiles') &&
Configuration.getConfig()?.logMaxSize
);
}
- static getLogLevel(): string | undefined {
+ public static getLogLevel(): string | undefined {
return Utils.hasOwnProp(Configuration.getConfig(), 'logLevel')
? Configuration.getConfig()?.logLevel?.toLowerCase()
: 'info';
}
- static getLogFile(): string | undefined {
+ public static getLogFile(): string | undefined {
return Utils.hasOwnProp(Configuration.getConfig(), 'logFile')
? Configuration.getConfig()?.logFile
: 'combined.log';
}
- static getLogErrorFile(): string | undefined {
+ public static getLogErrorFile(): string | undefined {
Configuration.warnDeprecatedConfigurationKey(
'errorFile',
undefined,
: 'error.log';
}
- static getSupervisionUrls(): string | string[] | undefined {
+ public static getSupervisionUrls(): string | string[] | undefined {
Configuration.warnDeprecatedConfigurationKey(
'supervisionURLs',
undefined,
return Configuration.getConfig()?.supervisionUrls;
}
- static getSupervisionUrlDistribution(): SupervisionUrlDistribution | undefined {
+ public static getSupervisionUrlDistribution(): SupervisionUrlDistribution | undefined {
Configuration.warnDeprecatedConfigurationKey(
'distributeStationToTenantEqually',
undefined,