From 738e3b6e1a0535b010b16976d76b19abb06e78b5 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 4 Jul 2022 11:23:24 +0200 Subject: [PATCH] containers - use python hack to get env var values from string --- helpers/entrypoint.sh | 3 ++- helpers/utils.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/helpers/entrypoint.sh b/helpers/entrypoint.sh index 7964b4b06..7b15d1243 100644 --- a/helpers/entrypoint.sh +++ b/helpers/entrypoint.sh @@ -61,7 +61,8 @@ if [ "$SWARM_MODE" != "yes" ] && [ "$KUBERNETES_MODE" != "yes" ] && [ "$AUTOCONF fi target="${target}${name}.conf" log "ENTRYPOINT" "ℹ️" "Saving custom config to $target ..." - echo "${!var_name}" > "$target" + content=$(python3 -c "import os ; print(os.environ['${var_name}'])") + echo "${content}" > "$target" done # execute temp nginx with no server diff --git a/helpers/utils.sh b/helpers/utils.sh index ee4784fd0..1a421eab0 100644 --- a/helpers/utils.sh +++ b/helpers/utils.sh @@ -56,7 +56,8 @@ function get_env() { 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}" + var_value=$(python3 -c "import os ; print(os.environ['${var_name}'])") + echo "${var_name}=${var_value}" fi done } \ No newline at end of file