Commit | Line | Data |
---|---|---|
66a7748d JB |
1 | import type { ListenOptions } from 'node:net' |
2 | import type { ResourceLimits } from 'node:worker_threads' | |
8114d10e | 3 | |
66a7748d | 4 | import type { WorkerChoiceStrategy } from 'poolifier' |
8114d10e | 5 | |
66a7748d JB |
6 | import type { StorageType } from './Storage.js' |
7 | import type { ApplicationProtocol, AuthenticationType } from './UIProtocol.js' | |
8 | import type { WorkerProcessType } from '../worker/index.js' | |
a4624c96 | 9 | |
66a7748d | 10 | type ServerOptions = ListenOptions |
66271092 | 11 | |
5d049829 JB |
12 | export enum ConfigurationSection { |
13 | log = 'log', | |
14 | performanceStorage = 'performanceStorage', | |
15 | worker = 'worker', | |
a807045b | 16 | uiServer = 'uiServer', |
5d049829 JB |
17 | } |
18 | ||
2dcfe98e JB |
19 | export enum SupervisionUrlDistribution { |
20 | ROUND_ROBIN = 'round-robin', | |
21 | RANDOM = 'random', | |
a807045b | 22 | CHARGING_STATION_AFFINITY = 'charging-station-affinity', |
2dcfe98e JB |
23 | } |
24 | ||
e1d9a0f4 | 25 | export interface StationTemplateUrl { |
66a7748d JB |
26 | file: string |
27 | numberOfStations: number | |
e1d9a0f4 | 28 | } |
e118beaa | 29 | |
e1d9a0f4 | 30 | export interface LogConfiguration { |
66a7748d 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 |
43 | export enum ApplicationProtocolVersion { |
44 | VERSION_11 = 1.1, | |
a807045b | 45 | VERSION_20 = 2.0, |
a6080904 JB |
46 | } |
47 | ||
e1d9a0f4 | 48 | export interface UIServerConfiguration { |
66a7748d JB |
49 | enabled?: boolean |
50 | type?: ApplicationProtocol | |
51 | version?: ApplicationProtocolVersion | |
52 | options?: ServerOptions | |
eb3abc4f | 53 | authentication?: { |
66a7748d JB |
54 | enabled: boolean |
55 | type: AuthenticationType | |
56 | username?: string | |
57 | password?: string | |
58 | } | |
e1d9a0f4 | 59 | } |
6a49ad23 | 60 | |
e1d9a0f4 | 61 | export interface StorageConfiguration { |
66a7748d JB |
62 | enabled?: boolean |
63 | type?: StorageType | |
64 | uri?: string | |
e1d9a0f4 | 65 | } |
72f041bd | 66 | |
66a7748d | 67 | export type ElementsPerWorkerType = number | 'auto' | 'all' |
47fb5f8f | 68 | |
e1d9a0f4 | 69 | export interface WorkerConfiguration { |
66a7748d JB |
70 | processType?: WorkerProcessType |
71 | startDelay?: number | |
72 | elementsPerWorker?: ElementsPerWorkerType | |
73 | elementStartDelay?: number | |
74 | poolMinSize?: number | |
75 | poolMaxSize?: number | |
76 | resourceLimits?: ResourceLimits | |
e1d9a0f4 | 77 | } |
cf2a5d9b | 78 | |
e1d9a0f4 | 79 | export interface ConfigurationData { |
66a7748d JB |
80 | supervisionUrls?: string | string[] |
81 | supervisionUrlDistribution?: SupervisionUrlDistribution | |
82 | stationTemplateUrls: StationTemplateUrl[] | |
83 | log?: LogConfiguration | |
84 | worker?: WorkerConfiguration | |
85 | uiServer?: UIServerConfiguration | |
86 | performanceStorage?: StorageConfiguration | |
b8efd65b | 87 | /** @deprecated Moved to charging station template */ |
66a7748d | 88 | autoReconnectMaxRetries?: number |
edd13439 | 89 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 90 | workerProcess?: WorkerProcessType |
edd13439 | 91 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 92 | workerStartDelay?: number |
edd13439 | 93 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 94 | elementStartDelay?: number |
edd13439 | 95 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 96 | workerPoolMinSize?: number |
edd13439 | 97 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 98 | workerPoolMaxSize?: number |
edd13439 | 99 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 100 | workerPoolStrategy?: WorkerChoiceStrategy |
edd13439 | 101 | /** @deprecated Moved to worker configuration section. */ |
66a7748d | 102 | chargingStationsPerWorker?: number |
3d48c1c1 | 103 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 104 | logStatisticsInterval?: number |
3d48c1c1 | 105 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 106 | logEnabled?: boolean |
3d48c1c1 | 107 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 108 | logConsole?: boolean |
3d48c1c1 | 109 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 110 | logFormat?: string |
3d48c1c1 | 111 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 112 | logLevel?: string |
3d48c1c1 | 113 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 114 | logRotate?: boolean |
3d48c1c1 | 115 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 116 | logMaxFiles?: number | string |
3d48c1c1 | 117 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 118 | logMaxSize?: number | string |
3d48c1c1 | 119 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 120 | logFile?: string |
3d48c1c1 | 121 | /** @deprecated Moved to log configuration section. */ |
66a7748d | 122 | logErrorFile?: string |
e1d9a0f4 | 123 | } |