| 1 | import type { ListenOptions } from 'node:net'; |
| 2 | |
| 3 | import type { WorkerChoiceStrategy } from 'poolifier'; |
| 4 | |
| 5 | import type { StorageType } from './Storage'; |
| 6 | import type { ApplicationProtocol, AuthenticationType } from './UIProtocol'; |
| 7 | import type { WorkerProcessType } from '../worker'; |
| 8 | |
| 9 | type ServerOptions = ListenOptions; |
| 10 | |
| 11 | export enum SupervisionUrlDistribution { |
| 12 | ROUND_ROBIN = 'round-robin', |
| 13 | RANDOM = 'random', |
| 14 | CHARGING_STATION_AFFINITY = 'charging-station-affinity', |
| 15 | } |
| 16 | |
| 17 | export type StationTemplateUrl = { |
| 18 | file: string; |
| 19 | numberOfStations: number; |
| 20 | }; |
| 21 | |
| 22 | export type UIServerConfiguration = { |
| 23 | enabled?: boolean; |
| 24 | type?: ApplicationProtocol; |
| 25 | options?: ServerOptions; |
| 26 | authentication?: { |
| 27 | enabled: boolean; |
| 28 | type: AuthenticationType; |
| 29 | username?: string; |
| 30 | password?: string; |
| 31 | }; |
| 32 | }; |
| 33 | |
| 34 | export type StorageConfiguration = { |
| 35 | enabled?: boolean; |
| 36 | type?: StorageType; |
| 37 | uri?: string; |
| 38 | }; |
| 39 | |
| 40 | export type WorkerConfiguration = { |
| 41 | processType?: WorkerProcessType; |
| 42 | startDelay?: number; |
| 43 | elementsPerWorker?: number; |
| 44 | elementStartDelay?: number; |
| 45 | poolMinSize?: number; |
| 46 | poolMaxSize?: number; |
| 47 | poolStrategy?: WorkerChoiceStrategy; |
| 48 | }; |
| 49 | |
| 50 | export type ConfigurationData = { |
| 51 | supervisionUrls?: string | string[]; |
| 52 | supervisionUrlDistribution?: SupervisionUrlDistribution; |
| 53 | stationTemplateUrls: StationTemplateUrl[]; |
| 54 | uiServer?: UIServerConfiguration; |
| 55 | performanceStorage?: StorageConfiguration; |
| 56 | worker?: WorkerConfiguration; |
| 57 | autoReconnectMaxRetries?: number; |
| 58 | /** @deprecated Moved to worker configuration section. */ |
| 59 | workerProcess?: WorkerProcessType; |
| 60 | /** @deprecated Moved to worker configuration section. */ |
| 61 | workerStartDelay?: number; |
| 62 | /** @deprecated Moved to worker configuration section. */ |
| 63 | elementStartDelay?: number; |
| 64 | /** @deprecated Moved to worker configuration section. */ |
| 65 | workerPoolMinSize?: number; |
| 66 | /** @deprecated Moved to worker configuration section. */ |
| 67 | workerPoolMaxSize?: number; |
| 68 | /** @deprecated Moved to worker configuration section. */ |
| 69 | workerPoolStrategy?: WorkerChoiceStrategy; |
| 70 | /** @deprecated Moved to worker configuration section. */ |
| 71 | chargingStationsPerWorker?: number; |
| 72 | logStatisticsInterval?: number; |
| 73 | logFormat?: string; |
| 74 | logLevel?: string; |
| 75 | logRotate?: boolean; |
| 76 | logMaxFiles?: number | string; |
| 77 | logMaxSize?: number | string; |
| 78 | logFile?: string; |
| 79 | logErrorFile?: string; |
| 80 | logConsole?: boolean; |
| 81 | }; |