| 1 | import { ListenOptions } from 'net'; |
| 2 | import { StorageType } from './Storage'; |
| 3 | import { ServerOptions as WSServerOptions } from 'ws'; |
| 4 | import type { WorkerChoiceStrategy } from 'poolifier'; |
| 5 | import { WorkerProcessType } from './Worker'; |
| 6 | |
| 7 | export type ServerOptions = WSServerOptions & ListenOptions; |
| 8 | |
| 9 | export enum SupervisionUrlDistribution { |
| 10 | ROUND_ROBIN = 'round-robin', |
| 11 | RANDOM = 'random', |
| 12 | SEQUENTIAL = 'sequential', |
| 13 | } |
| 14 | |
| 15 | export interface StationTemplateUrl { |
| 16 | file: string; |
| 17 | numberOfStations: number; |
| 18 | } |
| 19 | |
| 20 | export interface UIServerConfiguration { |
| 21 | enabled?: boolean; |
| 22 | options?: ServerOptions; |
| 23 | } |
| 24 | |
| 25 | export interface StorageConfiguration { |
| 26 | enabled?: boolean; |
| 27 | type?: StorageType; |
| 28 | uri?: string; |
| 29 | } |
| 30 | |
| 31 | export interface WorkerConfiguration { |
| 32 | processType?: WorkerProcessType; |
| 33 | startDelay?: number; |
| 34 | elementsPerWorker?: number; |
| 35 | elementStartDelay?: number; |
| 36 | poolMinSize?: number; |
| 37 | poolMaxSize?: number; |
| 38 | poolStrategy?: WorkerChoiceStrategy; |
| 39 | } |
| 40 | |
| 41 | export default interface ConfigurationData { |
| 42 | supervisionUrls?: string | string[]; |
| 43 | supervisionUrlDistribution?: SupervisionUrlDistribution; |
| 44 | stationTemplateUrls: StationTemplateUrl[]; |
| 45 | uiServer?: UIServerConfiguration; |
| 46 | performanceStorage?: StorageConfiguration; |
| 47 | worker?: WorkerConfiguration; |
| 48 | autoReconnectMaxRetries?: number; |
| 49 | // deprecated |
| 50 | workerProcess?: WorkerProcessType; |
| 51 | // deprecated |
| 52 | workerStartDelay?: number; |
| 53 | // deprecated |
| 54 | elementStartDelay?: number; |
| 55 | // deprecated |
| 56 | workerPoolMinSize?: number; |
| 57 | // deprecated |
| 58 | workerPoolMaxSize?: number; |
| 59 | // deprecated |
| 60 | workerPoolStrategy?: WorkerChoiceStrategy; |
| 61 | // deprecated |
| 62 | chargingStationsPerWorker?: number; |
| 63 | logStatisticsInterval?: number; |
| 64 | logFormat?: string; |
| 65 | logLevel?: string; |
| 66 | logRotate?: boolean; |
| 67 | logMaxFiles?: number; |
| 68 | logFile?: string; |
| 69 | logErrorFile?: string; |
| 70 | logConsole?: boolean; |
| 71 | } |