From 3e63f32215196a88149574ac927042653b0093ee Mon Sep 17 00:00:00 2001 From: Florian <1technophile@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:40:43 -0600 Subject: [PATCH] Add Identities and Bindkeys --- README.md | 3 +++ chroot/opt/venv/start.sh | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44f8575..7055d55 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ You can use following command to run if you don't have docker compose plugin ins docker run --rm \ --network host \ --privileged \ + --restart always \ -e MQTT_HOST= \ -e MQTT_USERNAME= \ -e MQTT_PASSWORD= \ @@ -118,6 +119,8 @@ docker run --rm \ -e ADAPTER=hci0 \ -e TIME_SYNC="[]" \ -e TIME_FORMAT=0 \ + -e IDENTITIES="{\"00:11:22:33:44:55:66\":\"0dc540f3025b474b9ef1085e051b1add\",\"AA:BB:CC:DD:EE:FF\":\"6385424e1b0341109942ad2a6bb42e58\"}" \ + -e BINDKEYS="{\"00:11:22:33:44:55:66\":\"0dc540f3025b474b9ef1085e051b1add\",\"AA:BB:CC:DD:EE:FF\":\"6385424e1b0341109942ad2a6bb42e58\"}" \ -v /var/run/dbus:/var/run/dbus \ --name theengsgateway \ theengs/gateway-ARCH:latest diff --git a/chroot/opt/venv/start.sh b/chroot/opt/venv/start.sh index 3d7d38e..776fb47 100755 --- a/chroot/opt/venv/start.sh +++ b/chroot/opt/venv/start.sh @@ -151,7 +151,8 @@ fi cd $VIRTUAL_ENV echo "Creating config at $CONFIG ..." -cat < $CONFIG +{ + cat < $CONFIG "time_format": "${TIME_FORMAT:-0}", "enable_tls": ${ENABLE_TLS:-false}, "enable_websocket": ${ENABLE_WEBSOCKET:-false} -} EOF + # Conditionally include IDENTITIES if not empty + if [ -n "$IDENTITIES" ]; then + echo ", \"identities\": $IDENTITIES" + fi + + # Conditionally include BINDKEYS if not empty + if [ -n "$BINDKEYS" ]; then + echo ", \"bindkeys\": $BINDKEYS" + fi + + echo "}" +} > $CONFIG + cat $CONFIG + python3 -m TheengsGateway $PARAMS