refactor: cleanup buffered messages handling code
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
3f85aa2b 1import type { ListenOptions } from 'node:net';
487f0dfd 2import type { ResourceLimits } from 'node:worker_threads';
8114d10e 3
9efbac5b 4import type { WorkerChoiceStrategy } from 'poolifier';
8114d10e 5
69074173
JB
6import type { StorageType } from './Storage';
7import type { ApplicationProtocol, AuthenticationType } from './UIProtocol';
268a74bb 8import type { WorkerProcessType } from '../worker';
a4624c96 9
0ac97927 10type ServerOptions = ListenOptions;
66271092 11
5d049829
JB
12export enum ConfigurationSection {
13 log = 'log',
14 performanceStorage = 'performanceStorage',
15 worker = 'worker',
16 uiServer = 'uiServer',
17}
18
2dcfe98e
JB
19export enum SupervisionUrlDistribution {
20 ROUND_ROBIN = 'round-robin',
21 RANDOM = 'random',
c72f6634 22 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
2dcfe98e
JB
23}
24
e1d9a0f4 25export interface StationTemplateUrl {
e118beaa
JB
26 file: string;
27 numberOfStations: number;
e1d9a0f4 28}
e118beaa 29
e1d9a0f4 30export interface LogConfiguration {
3d48c1c1
JB
31 enabled?: boolean;
32 file?: string;
33 errorFile?: string;
34 statisticsInterval?: number;
35 level?: string;
36 console?: boolean;
37 format?: string;
38 rotate?: boolean;
39 maxFiles?: string | number;
40 maxSize?: string | number;
e1d9a0f4 41}
3d48c1c1 42
a6080904
JB
43export enum ApplicationProtocolVersion {
44 VERSION_11 = 1.1,
45 VERSION_20 = 2.0,
46}
47
e1d9a0f4 48export interface UIServerConfiguration {
6a49ad23 49 enabled?: boolean;
1f7fa4de 50 type?: ApplicationProtocol;
a6080904 51 version?: ApplicationProtocolVersion;
66271092 52 options?: ServerOptions;
eb3abc4f
JB
53 authentication?: {
54 enabled: boolean;
55 type: AuthenticationType;
56 username?: string;
57 password?: string;
58 };
e1d9a0f4 59}
6a49ad23 60
e1d9a0f4 61export interface StorageConfiguration {
72f041bd
JB
62 enabled?: boolean;
63 type?: StorageType;
1f5df42a 64 uri?: string;
e1d9a0f4 65}
72f041bd 66
e1d9a0f4 67export interface WorkerConfiguration {
cf2a5d9b
JB
68 processType?: WorkerProcessType;
69 startDelay?: number;
c20d5d72 70 elementsPerWorker?: number | 'auto' | 'all';
cf2a5d9b
JB
71 elementStartDelay?: number;
72 poolMinSize?: number;
73 poolMaxSize?: number;
487f0dfd 74 resourceLimits?: ResourceLimits;
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}