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