refactor: split WorkerConstants class
[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
e1d9a0f4 42export interface UIServerConfiguration {
6a49ad23 43 enabled?: boolean;
1f7fa4de 44 type?: ApplicationProtocol;
66271092 45 options?: ServerOptions;
eb3abc4f
JB
46 authentication?: {
47 enabled: boolean;
48 type: AuthenticationType;
49 username?: string;
50 password?: string;
51 };
e1d9a0f4 52}
6a49ad23 53
e1d9a0f4 54export interface StorageConfiguration {
72f041bd
JB
55 enabled?: boolean;
56 type?: StorageType;
1f5df42a 57 uri?: string;
e1d9a0f4 58}
72f041bd 59
e1d9a0f4 60export interface WorkerConfiguration {
cf2a5d9b
JB
61 processType?: WorkerProcessType;
62 startDelay?: number;
8603c1ca 63 elementsPerWorker?: number | 'auto';
cf2a5d9b
JB
64 elementStartDelay?: number;
65 poolMinSize?: number;
66 poolMaxSize?: number;
eda9c451 67 /** @deprecated Not publicly exposed to end users. */
cf2a5d9b 68 poolStrategy?: WorkerChoiceStrategy;
e1d9a0f4 69}
cf2a5d9b 70
e1d9a0f4 71export interface ConfigurationData {
2dcfe98e
JB
72 supervisionUrls?: string | string[];
73 supervisionUrlDistribution?: SupervisionUrlDistribution;
1f5df42a 74 stationTemplateUrls: StationTemplateUrl[];
3d48c1c1
JB
75 log?: LogConfiguration;
76 worker?: WorkerConfiguration;
675fa8e3 77 uiServer?: UIServerConfiguration;
72f041bd 78 performanceStorage?: StorageConfiguration;
e118beaa 79 autoReconnectMaxRetries?: number;
edd13439 80 /** @deprecated Moved to worker configuration section. */
a4624c96 81 workerProcess?: WorkerProcessType;
edd13439 82 /** @deprecated Moved to worker configuration section. */
322c9192 83 workerStartDelay?: number;
edd13439 84 /** @deprecated Moved to worker configuration section. */
4bfd80fa 85 elementStartDelay?: number;
edd13439 86 /** @deprecated Moved to worker configuration section. */
a4624c96 87 workerPoolMinSize?: number;
edd13439 88 /** @deprecated Moved to worker configuration section. */
4fa59b8a 89 workerPoolMaxSize?: number;
edd13439 90 /** @deprecated Moved to worker configuration section. */
9efbac5b 91 workerPoolStrategy?: WorkerChoiceStrategy;
edd13439 92 /** @deprecated Moved to worker configuration section. */
5fdab605 93 chargingStationsPerWorker?: number;
3d48c1c1 94 /** @deprecated Moved to log configuration section. */
72f041bd 95 logStatisticsInterval?: number;
3d48c1c1 96 /** @deprecated Moved to log configuration section. */
ae389044 97 logEnabled?: boolean;
3d48c1c1 98 /** @deprecated Moved to log configuration section. */
ae389044 99 logConsole?: boolean;
3d48c1c1 100 /** @deprecated Moved to log configuration section. */
e118beaa 101 logFormat?: string;
3d48c1c1 102 /** @deprecated Moved to log configuration section. */
324fd4ee 103 logLevel?: string;
3d48c1c1 104 /** @deprecated Moved to log configuration section. */
6bf6769e 105 logRotate?: boolean;
3d48c1c1 106 /** @deprecated Moved to log configuration section. */
9988696d 107 logMaxFiles?: number | string;
3d48c1c1 108 /** @deprecated Moved to log configuration section. */
9988696d 109 logMaxSize?: number | string;
3d48c1c1 110 /** @deprecated Moved to log configuration section. */
e118beaa 111 logFile?: string;
3d48c1c1 112 /** @deprecated Moved to log configuration section. */
7ec46a9a 113 logErrorFile?: string;
e1d9a0f4 114}