forked from rand256/valetudo-mapper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
32 lines (30 loc) · 1.2 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const Configuration = require("./lib/Configuration");
const MqttClient = require("./lib/MqttClient");
const WebServer = require("./lib/Webserver");
const EventEmitter = require('events');
const conf = new Configuration();
const events = new EventEmitter();
if(conf.get("mqtt")) {
new MqttClient({
brokerURL: conf.get("mqtt").broker_url,
caPath: conf.get("mqtt").caPath,
identifier: conf.get("mqtt").identifier,
topicPrefix: conf.get("mqtt").topicPrefix,
autoconfPrefix: conf.get("mqtt").autoconfPrefix,
mapSettings: conf.get("mapSettings"),
mapDataTopic: conf.get("mqtt").mapDataTopic,
minMillisecondsBetweenMapUpdates: conf.get("mqtt").minMillisecondsBetweenMapUpdates,
publishMapImage: conf.get("mqtt").publishMapImage,
publishMapData: conf.get("mqtt").publishMapData,
webserverEnabled: conf.get("webserver") && conf.get("webserver").enabled === true,
events: events
});
if(conf.get("webserver") && conf.get("webserver").enabled === true) {
new WebServer({
port: conf.get("webserver").port,
events: events
})
}
} else {
console.error("Missing configuration.mqtt");
}