From 97adf45c51e177b012f63754528091f31474289d Mon Sep 17 00:00:00 2001 From: DasMoorhuhn Date: Thu, 29 Aug 2024 01:18:32 +0200 Subject: [PATCH] bugfix: -d mode didn't worked --- python/src/find_gateways.py | 6 +++--- run_gateway.sh | 31 ++++++------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/python/src/find_gateways.py b/python/src/find_gateways.py index 481bac9..726975a 100644 --- a/python/src/find_gateways.py +++ b/python/src/find_gateways.py @@ -10,7 +10,7 @@ DEBUG = True if os.environ.get('DEBUG') is not None else False DISCOVERY_ACK = 'IP_DISCOVERY_ACK'.encode() # ACK for broadcast DISCOVERY_RSP_GTW = 'IP_DISCOVERY_RSP_GTW'.encode() # RSP for gateway DISCOVERY_RSP_MSH = 'IP_DISCOVERY_RSP_MSH'.encode() # RSP for mesh -DISCOVERY_TIMEOUT = 1 +DISCOVERY_TIMEOUT = 0.5 SOCKET_TIMEOUT = 0.2 PORT_SERVER = 9434 PORT_CLIENT = 9435 @@ -73,5 +73,5 @@ def start_discovery_client(): return discovered_devices -# devices = start_discovery_client() -# print(f"Devices: {devices}") +devices = start_discovery_client() +print(f"Devices: {devices}") diff --git a/run_gateway.sh b/run_gateway.sh index c39f609..ea57757 100644 --- a/run_gateway.sh +++ b/run_gateway.sh @@ -46,19 +46,8 @@ docker_run() { check_for_devices_config if [ "$SKIP_ENV" = true ]; then - echo "Skip env file" ENV_EXISTS=false - BACKGROUND="" - TIME_ZONE="" - NAME="" - INTERACTIVE=true - BUILD=true - API=true - DEBUG="INFO" - MODE="1" - LOOP="40" - TIMEOUT="20" else if [ -e .env ] then @@ -69,9 +58,7 @@ docker_run() { echo No env file found ENV_EXISTS=false - BACKGROUND="" TIME_ZONE="" - NAME="" INTERACTIVE=true BUILD=true API=true @@ -96,6 +83,10 @@ docker_run() { COMMAND="$COMMAND --env-file .env" fi + if [ "$BACKGROUND" = "--detach" ]; then + INTERACTIVE=false + fi + if [ "$INTERACTIVE" = true ]; then COMMAND="$COMMAND --interactive" COMMAND="$COMMAND --tty" @@ -154,66 +145,57 @@ while [ "$1" != "" ]; do case $1 in -se | --skip-env-file ) SKIP_ENV=true + echo "Skip env file" shift ;; -d ) - BACKGROUND="-d" + BACKGROUND="--detach" shift ;; --debug ) shift DEBUG=$1 - SKIP_ENV=true shift ;; -a | --api) API=true - SKIP_ENV=true shift ;; -b | --build ) BUILD=true - SKIP_ENV=true shift ;; -v | --volume ) shift VOLUME=$1 - SKIP_ENV=true shift ;; -n | --name ) shift NAME=$1 - SKIP_ENV=true shift ;; -m2 | --mesh-gateway) MODE=2 - SKIP_ENV=true shift ;; -tz | --timezone ) shift TIME_ZONE=$1 - SKIP_ENV=true shift ;; -to | --timeout ) shift TIMEOUT=$1 - SKIP_ENV=true shift ;; -t | --tag ) shift TAG=$1 - SKIP_ENV=true shift ;; -l | --loop ) shift - SKIP_ENV=true firstchar=`echo $1 | cut -c1-1` if [ "$firstchar" = "-" ]; then LOOP=0 @@ -226,7 +208,6 @@ while [ "$1" != "" ]; do ;; -i | --interactive ) INTERACTIVE=true - SKIP_ENV=true shift ;; -h | --help )