From 5ac80a135c2cb92452466c2383f5d0333a1396c6 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 4 Jul 2022 10:44:38 +0200 Subject: [PATCH] containers - replace compgen command with a python hack because compgen -e do not display var with dots --- helpers/entrypoint.sh | 2 +- helpers/utils.sh | 2 +- tests/utils/utils.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/entrypoint.sh b/helpers/entrypoint.sh index fedb13e69..7964b4b06 100644 --- a/helpers/entrypoint.sh +++ b/helpers/entrypoint.sh @@ -46,7 +46,7 @@ fi if [ "$SWARM_MODE" != "yes" ] && [ "$KUBERNETES_MODE" != "yes" ] && [ "$AUTOCONF_MODE" != "yes" ] ; then # extract and drop configs - for var_name in $(compgen -e) ; do + for var_name in $(python3 -c 'import os ; [print(k) for k in os.environ]') ; do extracted=$(echo "$var_name" | sed -r 's/^([a-z\.\-]*)_?CUSTOM_CONF_(HTTP|DEFAULT_SERVER_HTTP|SERVER_HTTP|MODSEC|MODSEC_CRS)_(.*)$/\1 \2 \3/g') site=$(echo "$extracted" | cut -d ' ' -f 1) type=$(echo "$extracted" | cut -d ' ' -f 2 | grep -E '(HTTP|DEFAULT_SERVER_HTTP|SERVER_HTTP|MODSEC|MODSEC_CRS)' | tr '[:upper:]' '[:lower:]' | sed 's/_/-/') diff --git a/helpers/utils.sh b/helpers/utils.sh index ca5bf7807..ee4784fd0 100644 --- a/helpers/utils.sh +++ b/helpers/utils.sh @@ -53,7 +53,7 @@ function log() { # get only interesting env (var=value) function get_env() { -for var_name in $(compgen -e) ; do +for var_name in $(python3 -c 'import os ; [print(k) for k in os.environ]') ; do filter=$(echo -n "$var_name" | sed -r 's/^(HOSTNAME|PWD|PKG_RELEASE|NJS_VERSION|SHLVL|PATH|_|NGINX_VERSION|HOME|([a-z\.\-]*)_?CUSTOM_CONF_(HTTP|DEFAULT_SERVER_HTTP|SERVER_HTTP|MODSEC|MODSEC_CRS)_(.*))$//g') if [ "$filter" != "" ] ; then echo "${var_name}=${!var_name}" diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 3c185245f..b8a7d7f24 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -163,7 +163,7 @@ function curl_assert() { if [ "$ws" = "" ] ; then data="$(curl -k -L -s --cookie /dev/null -H "User-Agent: LegitOne" "$url" | grep -i "$str")" else - data="$(echo "test" | /tmp/websocat_amd64-linux - --text wss://test1.bunkerity.com/ws/ | grep -i "$str")" + data="$(echo "test" | /tmp/websocat_amd64-linux - --text "$url" | grep -i "$str")" fi if [ "$data" != "" ] && [ $? -eq 0 ] ; then return 0