ebec3a0d81aa327f5831a8a80a8fd1e8444baa36
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
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 ConfigurationSection {
12 log = 'log',
13 performanceStorage = 'performanceStorage',
14 worker = 'worker',
15 uiServer = 'uiServer',
16 }
17
18 export enum SupervisionUrlDistribution {
19 ROUND_ROBIN = 'round-robin',
20 RANDOM = 'random',
21 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
22 }
23
24 export interface StationTemplateUrl {
25 file: string;
26 numberOfStations: number;
27 }
28
29 export interface LogConfiguration {
30 enabled?: boolean;
31 file?: string;
32 errorFile?: string;
33 statisticsInterval?: number;
34 level?: string;
35 console?: boolean;
36 format?: string;
37 rotate?: boolean;
38 maxFiles?: string | number;
39 maxSize?: string | number;
40 }
41
42 export interface UIServerConfiguration {
43 enabled?: boolean;
44 type?: ApplicationProtocol;
45 options?: ServerOptions;
46 authentication?: {
47 enabled: boolean;
48 type: AuthenticationType;
49 username?: string;
50 password?: string;
51 };
52 }
53
54 export interface StorageConfiguration {
55 enabled?: boolean;
56 type?: StorageType;
57 uri?: string;
58 }
59
60 export interface WorkerConfiguration {
61 processType?: WorkerProcessType;
62 startDelay?: number;
63 elementsPerWorker?: number | 'auto';
64 elementStartDelay?: number;
65 poolMinSize?: number;
66 poolMaxSize?: number;
67 /** @deprecated Not publicly exposed to end users. */
68 poolStrategy?: WorkerChoiceStrategy;
69 }
70
71 export interface ConfigurationData {
72 supervisionUrls?: string | string[];
73 supervisionUrlDistribution?: SupervisionUrlDistribution;
74 stationTemplateUrls: StationTemplateUrl[];
75 log?: LogConfiguration;
76 worker?: WorkerConfiguration;
77 uiServer?: UIServerConfiguration;
78 performanceStorage?: StorageConfiguration;
79 autoReconnectMaxRetries?: number;
80 /** @deprecated Moved to worker configuration section. */
81 workerProcess?: WorkerProcessType;
82 /** @deprecated Moved to worker configuration section. */
83 workerStartDelay?: number;
84 /** @deprecated Moved to worker configuration section. */
85 elementStartDelay?: number;
86 /** @deprecated Moved to worker configuration section. */
87 workerPoolMinSize?: number;
88 /** @deprecated Moved to worker configuration section. */
89 workerPoolMaxSize?: number;
90 /** @deprecated Moved to worker configuration section. */
91 workerPoolStrategy?: WorkerChoiceStrategy;
92 /** @deprecated Moved to worker configuration section. */
93 chargingStationsPerWorker?: number;
94 /** @deprecated Moved to log configuration section. */
95 logStatisticsInterval?: number;
96 /** @deprecated Moved to log configuration section. */
97 logEnabled?: boolean;
98 /** @deprecated Moved to log configuration section. */
99 logConsole?: boolean;
100 /** @deprecated Moved to log configuration section. */
101 logFormat?: string;
102 /** @deprecated Moved to log configuration section. */
103 logLevel?: string;
104 /** @deprecated Moved to log configuration section. */
105 logRotate?: boolean;
106 /** @deprecated Moved to log configuration section. */
107 logMaxFiles?: number | string;
108 /** @deprecated Moved to log configuration section. */
109 logMaxSize?: number | string;
110 /** @deprecated Moved to log configuration section. */
111 logFile?: string;
112 /** @deprecated Moved to log configuration section. */
113 logErrorFile?: string;
114 }