X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FConfiguration.ts;h=afc992f8e7841b35f44a49841ee1c63f452e5285;hb=258a5c7f1cbdda8951d33aeedddaf5d4138dd0b8;hp=67cf501b02e24eb2e7356affc556d79bca311aff;hpb=d5bd1c008c3b2fbe6426ae12e1e12afe97807c57;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 67cf501b..afc992f8 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -1,3 +1,9 @@ +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +import chalk from 'chalk'; + import ConfigurationData, { StationTemplateUrl, StorageConfiguration, @@ -5,18 +11,14 @@ import ConfigurationData, { UIServerConfiguration, WorkerConfiguration, } from '../types/ConfigurationData'; - -import Constants from './Constants'; -import { EmptyObject } from '../types/EmptyObject'; +import type { EmptyObject } from '../types/EmptyObject'; +import type { HandleErrorParams } from '../types/Error'; import { FileType } from '../types/FileType'; -import { HandleErrorParams } from '../types/Error'; import { StorageType } from '../types/Storage'; -import WorkerConstants from '../worker/WorkerConstants'; +import { ApplicationProtocol } from '../types/UIProtocol'; import { WorkerProcessType } from '../types/Worker'; -import chalk from 'chalk'; -import { fileURLToPath } from 'url'; -import fs from 'fs'; -import path from 'path'; +import WorkerConstants from '../worker/WorkerConstants'; +import Constants from './Constants'; export default class Configuration { private static configurationFile = path.join( @@ -57,6 +59,7 @@ export default class Configuration { } let uiServerConfiguration: UIServerConfiguration = { enabled: true, + type: ApplicationProtocol.WS, options: { host: Constants.DEFAULT_UI_WEBSOCKET_SERVER_HOST, port: Constants.DEFAULT_UI_WEBSOCKET_SERVER_PORT, @@ -388,7 +391,7 @@ export default class Configuration { } private static isObject(item): boolean { - return item && typeof item === 'object' && !Array.isArray(item); + return item && typeof item === 'object' && Array.isArray(item) === false; } private static deepMerge(target: object, ...sources: object[]): object {