+ private static buildLogSection(): LogConfiguration {
+ const defaultLogConfiguration: LogConfiguration = {
+ enabled: true,
+ file: 'logs/combined.log',
+ errorFile: 'logs/error.log',
+ statisticsInterval: Constants.DEFAULT_LOG_STATISTICS_INTERVAL,
+ level: 'info',
+ format: 'simple',
+ rotate: true,
+ };
+ const deprecatedLogConfiguration: LogConfiguration = {
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logEnabled') && {
+ enabled: Configuration.getConfigurationData()?.logEnabled,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logFile') && {
+ file: Configuration.getConfigurationData()?.logFile,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logErrorFile') && {
+ errorFile: Configuration.getConfigurationData()?.logErrorFile,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logStatisticsInterval') && {
+ statisticsInterval: Configuration.getConfigurationData()?.logStatisticsInterval,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logLevel') && {
+ level: Configuration.getConfigurationData()?.logLevel,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logConsole') && {
+ console: Configuration.getConfigurationData()?.logConsole,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logFormat') && {
+ format: Configuration.getConfigurationData()?.logFormat,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logRotate') && {
+ rotate: Configuration.getConfigurationData()?.logRotate,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logMaxFiles') && {
+ maxFiles: Configuration.getConfigurationData()?.logMaxFiles,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'logMaxSize') && {
+ maxSize: Configuration.getConfigurationData()?.logMaxSize,
+ }),
+ };
+ const logConfiguration: LogConfiguration = {
+ ...defaultLogConfiguration,
+ ...deprecatedLogConfiguration,
+ ...(hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.log) &&
+ Configuration.getConfigurationData()?.log),
+ };
+ return logConfiguration;
+ }
+
+ private static buildWorkerSection(): WorkerConfiguration {
+ const defaultWorkerConfiguration: WorkerConfiguration = {
+ processType: WorkerProcessType.workerSet,
+ startDelay: DEFAULT_WORKER_START_DELAY,
+ elementsPerWorker: 'auto',
+ elementStartDelay: DEFAULT_ELEMENT_START_DELAY,
+ poolMinSize: DEFAULT_POOL_MIN_SIZE,
+ poolMaxSize: DEFAULT_POOL_MAX_SIZE,
+ };
+ const deprecatedWorkerConfiguration: WorkerConfiguration = {
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'workerProcess') && {
+ processType: Configuration.getConfigurationData()?.workerProcess,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'workerStartDelay') && {
+ startDelay: Configuration.getConfigurationData()?.workerStartDelay,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'chargingStationsPerWorker') && {
+ elementsPerWorker: Configuration.getConfigurationData()?.chargingStationsPerWorker,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'elementStartDelay') && {
+ elementStartDelay: Configuration.getConfigurationData()?.elementStartDelay,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'workerPoolMinSize') && {
+ poolMinSize: Configuration.getConfigurationData()?.workerPoolMinSize,
+ }),
+ ...(hasOwnProp(Configuration.getConfigurationData(), 'workerPoolMaxSize') && {
+ poolMaxSize: Configuration.getConfigurationData()?.workerPoolMaxSize,
+ }),
+ };
+ hasOwnProp(Configuration.getConfigurationData(), 'workerPoolStrategy') &&
+ delete Configuration.getConfigurationData()?.workerPoolStrategy;
+ const workerConfiguration: WorkerConfiguration = {
+ ...defaultWorkerConfiguration,
+ ...deprecatedWorkerConfiguration,
+ ...(hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.worker) &&
+ Configuration.getConfigurationData()?.worker),
+ };
+ if (!Object.values(WorkerProcessType).includes(workerConfiguration.processType!)) {
+ throw new SyntaxError(
+ `Invalid worker process type '${workerConfiguration.processType}' defined in configuration`,
+ );
+ }
+ return workerConfiguration;
+ }
+
+ private static checkDeprecatedConfigurationKeys() {
+ // connection timeout