X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FConfiguration.ts;h=90e846036074be5f3b71146df687313706b9cd3f;hb=7436ee0df05bb41f3ce8a553adf5d9ed8da78903;hp=5cf5d816f2747f758e035015c7d7a1629f7e1f35;hpb=ef4932d8aec470321413643e3c0647b0b29396de;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 5cf5d816..90e84603 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -6,7 +6,10 @@ import chalk from 'chalk'; import merge from 'just-merge'; import { WorkerChoiceStrategies } from 'poolifier'; -import { Constants, FileUtils, Utils } from './internal'; +// import { Constants, FileUtils, Utils } from './internal'; +import { Constants } from './Constants'; +import { FileUtils } from './FileUtils'; +import { Utils } from './Utils'; import { ApplicationProtocol, type ConfigurationData, @@ -125,16 +128,18 @@ export class Configuration { !Utils.isUndefined(Configuration.getConfig()['stationTemplateURLs']) && (Configuration.getConfig().stationTemplateUrls = Configuration.getConfig()[ 'stationTemplateURLs' - ] as unknown as StationTemplateUrl[]); - Configuration.getConfig().stationTemplateUrls.forEach((stationUrl: StationTemplateUrl) => { - if (!Utils.isUndefined(stationUrl['numberOfStation'])) { - console.error( - chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key 'numberOfStation' usage for template file '${ - stationUrl.file - }' in 'stationTemplateUrls'. Use 'numberOfStations' instead}` - ); + ] as StationTemplateUrl[]); + Configuration.getConfig().stationTemplateUrls.forEach( + (stationTemplateUrl: StationTemplateUrl) => { + if (!Utils.isUndefined(stationTemplateUrl['numberOfStation'])) { + console.error( + chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key 'numberOfStation' usage for template file '${ + stationTemplateUrl.file + }' in 'stationTemplateUrls'. Use 'numberOfStations' instead}` + ); + } } - }); + ); // Read conf return Configuration.getConfig()?.stationTemplateUrls; } @@ -188,7 +193,7 @@ export class Configuration { let workerConfiguration: WorkerConfiguration = { processType: Utils.hasOwnProp(Configuration.getConfig(), 'workerProcess') ? Configuration.getConfig()?.workerProcess - : WorkerProcessType.WORKER_SET, + : WorkerProcessType.workerSet, startDelay: Utils.hasOwnProp(Configuration.getConfig(), 'workerStartDelay') ? Configuration.getConfig()?.workerStartDelay : WorkerConstants.DEFAULT_WORKER_START_DELAY, @@ -319,13 +324,13 @@ export class Configuration { ) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${ - logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}` + logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' }}` ); } else if (!Utils.isUndefined(Configuration.getConfig()[key])) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${ - logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}` + logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' }}` ); }