Merge branch 'main' into dependabot/github_actions/sonarsource/sonarcloud-github...
[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;
b8efd65b 85 /** @deprecated Moved to charging station template */
e118beaa 86 autoReconnectMaxRetries?: number;
edd13439 87 /** @deprecated Moved to worker configuration section. */
a4624c96 88 workerProcess?: WorkerProcessType;
edd13439 89 /** @deprecated Moved to worker configuration section. */
322c9192 90 workerStartDelay?: number;
edd13439 91 /** @deprecated Moved to worker configuration section. */
4bfd80fa 92 elementStartDelay?: number;
edd13439 93 /** @deprecated Moved to worker configuration section. */
a4624c96 94 workerPoolMinSize?: number;
edd13439 95 /** @deprecated Moved to worker configuration section. */
4fa59b8a 96 workerPoolMaxSize?: number;
edd13439 97 /** @deprecated Moved to worker configuration section. */
9efbac5b 98 workerPoolStrategy?: WorkerChoiceStrategy;
edd13439 99 /** @deprecated Moved to worker configuration section. */
5fdab605 100 chargingStationsPerWorker?: number;
3d48c1c1 101 /** @deprecated Moved to log configuration section. */
72f041bd 102 logStatisticsInterval?: number;
3d48c1c1 103 /** @deprecated Moved to log configuration section. */
ae389044 104 logEnabled?: boolean;
3d48c1c1 105 /** @deprecated Moved to log configuration section. */
ae389044 106 logConsole?: boolean;
3d48c1c1 107 /** @deprecated Moved to log configuration section. */
e118beaa 108 logFormat?: string;
3d48c1c1 109 /** @deprecated Moved to log configuration section. */
324fd4ee 110 logLevel?: string;
3d48c1c1 111 /** @deprecated Moved to log configuration section. */
6bf6769e 112 logRotate?: boolean;
3d48c1c1 113 /** @deprecated Moved to log configuration section. */
9988696d 114 logMaxFiles?: number | string;
3d48c1c1 115 /** @deprecated Moved to log configuration section. */
9988696d 116 logMaxSize?: number | string;
3d48c1c1 117 /** @deprecated Moved to log configuration section. */
e118beaa 118 logFile?: string;
3d48c1c1 119 /** @deprecated Moved to log configuration section. */
7ec46a9a 120 logErrorFile?: string;
e1d9a0f4 121}