feat: added environment variables for configuration
continuous-integration/drone Build is passing
Details
continuous-integration/drone Build is passing
Details
feat: added SIGINT event for CTRL+C support
This commit is contained in:
parent
d8e93ed525
commit
0082d4932b
|
@ -23,6 +23,13 @@ Fionera fügte HTML5 Push notifications hinzu.
|
||||||
|
|
||||||
Danach kleinere Änderungen und Erweiterungen von henne, zeus, smash.
|
Danach kleinere Änderungen und Erweiterungen von henne, zeus, smash.
|
||||||
|
|
||||||
|
## config via environment variablen
|
||||||
|
|
||||||
|
PING_INTERVAL_MS default 60000
|
||||||
|
MQTT_SERVER default 'mqtt://mqtt.ctdo.de
|
||||||
|
FLUKSO_URL default "/sensor/cf00e0b22230f4a8870af58f2b8719dd
|
||||||
|
FLUKSO_HOST default"flukso.raum.ctdo.de"
|
||||||
|
STATUS_POLL_HOST default "snapserv.ctdo.de"
|
||||||
|
|
||||||
|
|
||||||
## Entrümpelung 2022
|
## Entrümpelung 2022
|
||||||
|
@ -30,7 +37,7 @@ Danach kleinere Änderungen und Erweiterungen von henne, zeus, smash.
|
||||||
Das meiste an Funktionn wurde wiede raus geworfen weil sich die CTDO infrastruktur
|
Das meiste an Funktionn wurde wiede raus geworfen weil sich die CTDO infrastruktur
|
||||||
sehr verändert hat und einiges kaputt war.
|
sehr verändert hat und einiges kaputt war.
|
||||||
|
|
||||||
Der Status zeit nur noch Power und Raumstatus an. Es läuft wie gehabt via nmap-Ping.
|
Der Status zeigt nur noch Power und Raumstatus an. Es läuft wie gehabt via ICMP Ping.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ var IpPoll = require("./ip-poll");
|
||||||
var routes = require("./routes");
|
var routes = require("./routes");
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var mqttClient = require('mqtt');
|
var mqttClient = require('mqtt');
|
||||||
|
var process = require('process')
|
||||||
|
|
||||||
var spaceanswer = {
|
var spaceanswer = {
|
||||||
api: "0.13",
|
api: "0.13",
|
||||||
|
@ -63,16 +64,20 @@ var spaceanswer = {
|
||||||
var simpleanswer = {state: "unknown", lastchange: 0, power: 0};
|
var simpleanswer = {state: "unknown", lastchange: 0, power: 0};
|
||||||
|
|
||||||
|
|
||||||
var ippoll = new IpPoll("rpi3.raum.ctdo.de");
|
var ippoll = new IpPoll(process.env.STATUS_POLL_HOST || "snapserv.ctdo.de");
|
||||||
var flukso = new Flukso(process.env.FLUKSO_HOST || "flukso.raum.ctdo.de",
|
var flukso = new Flukso(process.env.FLUKSO_HOST || "flukso.raum.ctdo.de",
|
||||||
process.env.FLUKSO_URL || "/sensor/cf00e0b22230f4a8870af58f2b8719dd");
|
process.env.FLUKSO_URL || "/sensor/cf00e0b22230f4a8870af58f2b8719dd");
|
||||||
var mqtt = mqttClient.connect(process.env.MQTT_SERVER || 'mqtt://mqtt.ctdo.de');
|
var mqtt = mqttClient.connect(process.env.MQTT_SERVER || 'mqtt://mqtt.ctdo.de');
|
||||||
var connected = false;
|
var connected = false;
|
||||||
|
|
||||||
//express js settings
|
//express js settings
|
||||||
var port = '9911';
|
var port = process.env.HTTP_PORT || '9911';
|
||||||
var address = '0.0.0.0';
|
var address = '0.0.0.0';
|
||||||
|
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
console.info("Interrupted")
|
||||||
|
process.exit(0)
|
||||||
|
})
|
||||||
|
|
||||||
ippoll.on('doneState', function (state) {
|
ippoll.on('doneState', function (state) {
|
||||||
spaceanswer.state.open = state;
|
spaceanswer.state.open = state;
|
||||||
|
@ -114,7 +119,7 @@ function work() {
|
||||||
sendSimple();
|
sendSimple();
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(work, 60000);
|
setInterval(work, process.env.PING_INTERVAL_MS || 60000);
|
||||||
work();
|
work();
|
||||||
|
|
||||||
setInterval(flukso.pollPower, 5000);
|
setInterval(flukso.pollPower, 5000);
|
||||||
|
|
Loading…
Reference in New Issue