Compare commits
No commits in common. "d4fce11f5a949dd08b99184cf2fbebe9ad17ac3c" and "646dc187184f30ea3398957065e03e5198f02736" have entirely different histories.
d4fce11f5a
...
646dc18718
|
@ -2,16 +2,17 @@ FROM debian:10
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get upgrade -y
|
RUN apt-get upgrade -y
|
||||||
RUN apt-get install -y \
|
RUN apt-get install -y \
|
||||||
php7.3-cli php-json \
|
php7.3-cli php-json \
|
||||||
php-pear php-dev \
|
php-pear php-dev \
|
||||||
libmosquitto-dev libmosquitto1 mosquitto-clients \
|
libmosquitto-dev libmosquitto1 mosquitto-clients \
|
||||||
php-yaml \
|
php-yaml \
|
||||||
locales-all
|
locales-all
|
||||||
RUN pecl install Mosquitto-alpha
|
RUN pecl install Mosquitto-alpha
|
||||||
RUN echo "extension=mosquitto.so" > /etc/php/7.3/mods-available/mosquitto.ini
|
RUN echo "extension=mosquitto.so" >/etc/php/7.3/mods-available/mosquitto.ini
|
||||||
RUN ln -s /etc/php/7.3/mods-available/mosquitto.ini /etc/php/7.3/cli/conf.d/20-mosquitto.ini
|
RUN ln -s /etc/php/7.3/mods-available/mosquitto.ini /etc/php/7.3/cli/conf.d/20-mosquitto.ini
|
||||||
ADD . /app
|
ADD . /app
|
||||||
|
|
||||||
VOLUME /app/public
|
VOLUME /app/public
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT /app/generator.php
|
ENTRYPOINT /app/generator.php
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
mqtt:
|
mqtt:
|
||||||
host: $MQTT_HOST
|
host: $MQTT_HOST
|
||||||
user: $MQTT_USER
|
user: $MQTT_USER
|
||||||
password: $MQTT_PASSWORD
|
password: $MQTT_PASSWORD
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
doorstatus:
|
doorstatus:
|
||||||
|
@ -16,3 +16,4 @@ variables:
|
||||||
werkstatt_temp:
|
werkstatt_temp:
|
||||||
topic: c3re/werkstatttemp
|
topic: c3re/werkstatttemp
|
||||||
cast: float
|
cast: float
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ $c->onMessage(function (\Mosquitto\Message $message) use (&$data, $conf) {
|
||||||
" unknown\n";
|
" unknown\n";
|
||||||
die(1);
|
die(1);
|
||||||
}
|
}
|
||||||
|
var_dump($data);
|
||||||
$data[$message->topic]["changed"] = time();
|
$data[$message->topic]["changed"] = time();
|
||||||
$out = file_get_contents(__DIR__ . "/template.json");
|
$out = file_get_contents(__DIR__ . "/template.json");
|
||||||
$out = preg_replace_callback(
|
$out = preg_replace_callback(
|
||||||
|
@ -68,9 +69,7 @@ $c->onMessage(function (\Mosquitto\Message $message) use (&$data, $conf) {
|
||||||
if (!is_dir("public")) {
|
if (!is_dir("public")) {
|
||||||
mkdir("public");
|
mkdir("public");
|
||||||
}
|
}
|
||||||
file_put_contents("public/spaceapi.json.new", $out);
|
file_put_contents("public/spaceapi.json", $out);
|
||||||
// ensure atomic update
|
|
||||||
rename("public/spaceapi.json.new", "public/spaceapi.json");
|
|
||||||
});
|
});
|
||||||
$c->connect($conf["mqtt"]["host"]);
|
$c->connect($conf["mqtt"]["host"]);
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
Loading…
Reference in New Issue