forked from freifunkMUC/wgkex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·50 lines (44 loc) · 976 Bytes
/
entrypoint
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
: ${WGKEX_DOMAINS:="ffmuc_freising, ffmuc_gauting, ffmuc_muc_cty, ffmuc_muc_nord, ffmuc_muc_ost, ffmuc_muc_sued, ffmuc_muc_west, ffmuc_uml_nord, ffmuc_uml_ost, ffmuc_uml_sued, ffmuc_uml_west, ffmuc_welt"}
: ${WGKEX_DOMAIN_PREFIX:="ffmuc_"}
: ${WGKEX_DEBUG:="DEBUG"}
: ${MQTT_BROKER_URL:="mqtt"}
: ${MQTT_BROKER_PORT:="1883"}
: ${MQTT_USERNAME:=""}
: ${MQTT_PASSWORD:=""}
: ${MQTT_KEEPALIVE:="5"}
: ${MQTT_TLS:="False"}
mk_config() {
if [ ! -e /etc/wgkex.yaml ] ; then
(
echo "domains:"
IFS=", "
for i in $WGKEX_DOMAINS; do
echo " - $i"
done
cat <<EOF
log_level: $WGKEX_DEBUG
domain_prefix: $WGKEX_DOMAIN_PREFIX
mqtt:
broker_url: $MQTT_BROKER_URL
broker_port: $MQTT_BROKER_PORT
username: $MQTT_USERNAME
password: $MQTT_PASSWORD
keepalive: $MQTT_KEEPALIVE
tls: $MQTT_TLS
EOF
unset IFS
) > /etc/wgkex.yaml
fi
}
mk_config
case "$1" in
broker)
exec ./wgkex/broker/app
;;
worker)
exec ./wgkex/worker/app
;;
esac
exec "$@"