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