Commit | Line | Data |
---|---|---|
4d127f7f | 1 | const config = require('../assets/config.json'); |
7dde0b73 JB |
2 | |
3 | class Configuration { | |
4 | // Read the config file | |
5 | static getConfig() { | |
6 | return config; | |
7 | } | |
8 | ||
9 | static getStatisticsDisplayInterval() { | |
10 | // Read conf | |
11 | return Configuration.getConfig().statisticsDisplayInterval; | |
12 | } | |
13 | ||
14 | static getAutoReconnectTimeout() { | |
15 | // Read conf | |
16 | return Configuration.getConfig().hasOwnProperty('autoReconnectTimeout') ? Configuration.getConfig().autoReconnectTimeout : 10; | |
17 | } | |
18 | ||
19 | static getAutoReconnectMaxRetries() { | |
20 | // Read conf | |
21 | return Configuration.getConfig().hasOwnProperty('autoReconnectMaxRetries') ? Configuration.getConfig().autoReconnectMaxRetries : -1; | |
22 | } | |
23 | ||
24 | static getChargingStationTemplateURLs() { | |
25 | // Read conf | |
26 | return Configuration.getConfig().stationTemplateURLs; | |
27 | } | |
28 | ||
29 | static getChargingStationTemplate() { | |
30 | // Read conf | |
31 | return Configuration.getConfig().stationTemplate; | |
32 | } | |
33 | ||
34 | static getNumberofChargingStation() { | |
35 | // Read conf | |
36 | return (Configuration.getConfig().numberOfStation ? Configuration.getConfig().numberOfStation : 0); | |
37 | } | |
38 | ||
39 | static useWorkerPool() { | |
40 | return Configuration.getConfig().useWorkerPool; | |
41 | } | |
42 | ||
43 | static getWorkerPoolSize() { | |
44 | return Configuration.getConfig().workerPoolSize; | |
45 | } | |
46 | ||
47 | static getConsoleLog() { | |
48 | return (Configuration.getConfig().hasOwnProperty('consoleLog') ? Configuration.getConfig().consoleLog : false); | |
49 | } | |
50 | ||
51 | static getLogFile() { | |
52 | return (Configuration.getConfig().hasOwnProperty('logFile') ? Configuration.getConfig().logFile : 'combined.log'); | |
53 | } | |
54 | ||
55 | static getErrorFile() { | |
56 | return (Configuration.getConfig().hasOwnProperty('errorFile') ? Configuration.getConfig().errorFile : 'error.log'); | |
57 | } | |
58 | ||
59 | static getMeterValueInterval() { | |
60 | // Read conf | |
61 | return (Configuration.getChargingStationConfiguration().hasOwnProperty('meterValueInterval') ? Configuration.getChargingStationConfiguration().meterValueInterval * 1000 : 60000); | |
62 | } | |
63 | ||
64 | static getAutomaticTransactionConfiguration() { | |
65 | // Read conf | |
66 | return Configuration.getChargingStationTemplate().AutomaticTransactionGenerator; | |
67 | } | |
68 | ||
69 | static getSupervisionURLs() { | |
70 | // Read conf | |
71 | return Configuration.getConfig().supervisionURLs; | |
72 | } | |
73 | ||
74 | static getEquallySupervisionDistribution() { | |
75 | return Configuration.getConfig().distributeStationToTenantEqually; | |
76 | } | |
77 | ||
78 | static getChargingStationConfiguration() { | |
79 | return (Configuration.getChargingStationTemplate().hasOwnProperty('Configuration') ? Configuration.getChargingStationTemplate().Configuration : {}); | |
80 | } | |
81 | ||
82 | static getChargingStationAuthorizationFile() { | |
83 | return (Configuration.getChargingStationTemplate().hasOwnProperty('authorizationFile') ? Configuration.getChargingStationTemplate().authorizationFile : ''); | |
84 | } | |
85 | ||
86 | static getChargingStationConnectors() { | |
87 | return Configuration.getChargingStationTemplate().Connectors; | |
88 | } | |
89 | ||
90 | static getChargingStationConnector(number) { | |
91 | return Configuration.getChargingStationTemplate().Connectors[number]; | |
92 | } | |
93 | } | |
94 | ||
95 | module.exports = Configuration; |