feat: add initial HTTP/2 support to ui server (mutually exclusive for now)
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
3f85aa2b 1import type { ListenOptions } from 'node:net';
8114d10e 2
9efbac5b 3import type { WorkerChoiceStrategy } from 'poolifier';
8114d10e 4
69074173
JB
5import type { StorageType } from './Storage';
6import type { ApplicationProtocol, AuthenticationType } from './UIProtocol';
268a74bb 7import type { WorkerProcessType } from '../worker';
a4624c96 8
0ac97927 9type ServerOptions = ListenOptions;
66271092 10
5d049829
JB
11export enum ConfigurationSection {
12 log = 'log',
13 performanceStorage = 'performanceStorage',
14 worker = 'worker',
15 uiServer = 'uiServer',
16}
17
2dcfe98e
JB
18export enum SupervisionUrlDistribution {
19 ROUND_ROBIN = 'round-robin',
20 RANDOM = 'random',
c72f6634 21 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
2dcfe98e
JB
22}
23
e1d9a0f4 24export interface StationTemplateUrl {
e118beaa
JB
25 file: string;
26 numberOfStations: number;
e1d9a0f4 27}
e118beaa 28
e1d9a0f4 29export interface LogConfiguration {
3d48c1c1
JB
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;
e1d9a0f4 40}
3d48c1c1 41
a6080904
JB
42export enum ApplicationProtocolVersion {
43 VERSION_11 = 1.1,
44 VERSION_20 = 2.0,
45}
46
e1d9a0f4 47export interface UIServerConfiguration {
6a49ad23 48 enabled?: boolean;
1f7fa4de 49 type?: ApplicationProtocol;
a6080904 50 version?: ApplicationProtocolVersion;
66271092 51 options?: ServerOptions;
eb3abc4f
JB
52 authentication?: {
53 enabled: boolean;
54 type: AuthenticationType;
55 username?: string;
56 password?: string;
57 };
e1d9a0f4 58}
6a49ad23 59
e1d9a0f4 60export interface StorageConfiguration {
72f041bd
JB
61 enabled?: boolean;
62 type?: StorageType;
1f5df42a 63 uri?: string;
e1d9a0f4 64}
72f041bd 65
e1d9a0f4 66export interface WorkerConfiguration {
cf2a5d9b
JB
67 processType?: WorkerProcessType;
68 startDelay?: number;
8603c1ca 69 elementsPerWorker?: number | 'auto';
cf2a5d9b
JB
70 elementStartDelay?: number;
71 poolMinSize?: number;
72 poolMaxSize?: number;
eda9c451 73 /** @deprecated Not publicly exposed to end users. */
cf2a5d9b 74 poolStrategy?: WorkerChoiceStrategy;
e1d9a0f4 75}
cf2a5d9b 76
e1d9a0f4 77export interface ConfigurationData {
2dcfe98e
JB
78 supervisionUrls?: string | string[];
79 supervisionUrlDistribution?: SupervisionUrlDistribution;
1f5df42a 80 stationTemplateUrls: StationTemplateUrl[];
3d48c1c1
JB
81 log?: LogConfiguration;
82 worker?: WorkerConfiguration;
675fa8e3 83 uiServer?: UIServerConfiguration;
72f041bd 84 performanceStorage?: StorageConfiguration;
e118beaa 85 autoReconnectMaxRetries?: number;
edd13439 86 /** @deprecated Moved to worker configuration section. */
a4624c96 87 workerProcess?: WorkerProcessType;
edd13439 88 /** @deprecated Moved to worker configuration section. */
322c9192 89 workerStartDelay?: number;
edd13439 90 /** @deprecated Moved to worker configuration section. */
4bfd80fa 91 elementStartDelay?: number;
edd13439 92 /** @deprecated Moved to worker configuration section. */
a4624c96 93 workerPoolMinSize?: number;
edd13439 94 /** @deprecated Moved to worker configuration section. */
4fa59b8a 95 workerPoolMaxSize?: number;
edd13439 96 /** @deprecated Moved to worker configuration section. */
9efbac5b 97 workerPoolStrategy?: WorkerChoiceStrategy;
edd13439 98 /** @deprecated Moved to worker configuration section. */
5fdab605 99 chargingStationsPerWorker?: number;
3d48c1c1 100 /** @deprecated Moved to log configuration section. */
72f041bd 101 logStatisticsInterval?: number;
3d48c1c1 102 /** @deprecated Moved to log configuration section. */
ae389044 103 logEnabled?: boolean;
3d48c1c1 104 /** @deprecated Moved to log configuration section. */
ae389044 105 logConsole?: boolean;
3d48c1c1 106 /** @deprecated Moved to log configuration section. */
e118beaa 107 logFormat?: string;
3d48c1c1 108 /** @deprecated Moved to log configuration section. */
324fd4ee 109 logLevel?: string;
3d48c1c1 110 /** @deprecated Moved to log configuration section. */
6bf6769e 111 logRotate?: boolean;
3d48c1c1 112 /** @deprecated Moved to log configuration section. */
9988696d 113 logMaxFiles?: number | string;
3d48c1c1 114 /** @deprecated Moved to log configuration section. */
9988696d 115 logMaxSize?: number | string;
3d48c1c1 116 /** @deprecated Moved to log configuration section. */
e118beaa 117 logFile?: string;
3d48c1c1 118 /** @deprecated Moved to log configuration section. */
7ec46a9a 119 logErrorFile?: string;
e1d9a0f4 120}