From 6cceb449052dbbb075a4bd8849b47d5a5ba376af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Jer=C3=B3nimo?= Date: Thu, 1 Feb 2024 18:07:18 +0000 Subject: [PATCH 1/3] Changed if statements to be POSIX compliant --- docker/entrypoint-frontend.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint-frontend.sh b/docker/entrypoint-frontend.sh index c37563fd..b870f8bd 100644 --- a/docker/entrypoint-frontend.sh +++ b/docker/entrypoint-frontend.sh @@ -2,6 +2,6 @@ CONF="/etc/nginx/conf.d/default.conf" -[[ ! -z "${ABRECHNUNG_API__HOST}" ]] && sed -i "s/api:/${ABRECHNUNG_API__HOST}:/g" "$CONF" -[[ ! -z "${ABRECHNUNG_API__PORT}" ]] && sed -i "s/:8080/:${ABRECHNUNG_API__PORT}/g" "$CONF" -[[ ! -f "/proc/net/if_inet6" ]] && sed -i "s/listen \[::\]/#listen \[::\]/g" "$CONF" +[ ! -z "${ABRECHNUNG_API__HOST}" ] && sed -i "s/api:/${ABRECHNUNG_API__HOST}:/g" "$CONF" +[ ! -z "${ABRECHNUNG_API__PORT}" ] && sed -i "s/:8080/:${ABRECHNUNG_API__PORT}/g" "$CONF" +[ ! -f "/proc/net/if_inet6" ] && sed -i "s/listen \[::\]/#listen \[::\]/g" "$CONF" From 8b6d93e0448db969750255f907f5ce171a5a42ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Jer=C3=B3nimo?= Date: Thu, 1 Feb 2024 18:13:31 +0000 Subject: [PATCH 2/3] Optimized conditions --- docker/entrypoint-frontend.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint-frontend.sh b/docker/entrypoint-frontend.sh index b870f8bd..90b5587d 100644 --- a/docker/entrypoint-frontend.sh +++ b/docker/entrypoint-frontend.sh @@ -2,6 +2,6 @@ CONF="/etc/nginx/conf.d/default.conf" -[ ! -z "${ABRECHNUNG_API__HOST}" ] && sed -i "s/api:/${ABRECHNUNG_API__HOST}:/g" "$CONF" -[ ! -z "${ABRECHNUNG_API__PORT}" ] && sed -i "s/:8080/:${ABRECHNUNG_API__PORT}/g" "$CONF" +[ -n "${ABRECHNUNG_API__HOST}" ] && sed -i "s/api:/${ABRECHNUNG_API__HOST}:/g" "$CONF" +[ -n "${ABRECHNUNG_API__PORT}" ] && sed -i "s/:8080/:${ABRECHNUNG_API__PORT}/g" "$CONF" [ ! -f "/proc/net/if_inet6" ] && sed -i "s/listen \[::\]/#listen \[::\]/g" "$CONF" From b530fbefa7687d3eb416780088aa4568f16159a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Jer=C3=B3nimo?= Date: Thu, 1 Feb 2024 18:47:28 +0000 Subject: [PATCH 3/3] Fixed bug where sed would replace substring matches on every container restart --- docker/entrypoint-frontend.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint-frontend.sh b/docker/entrypoint-frontend.sh index 90b5587d..efbace8c 100644 --- a/docker/entrypoint-frontend.sh +++ b/docker/entrypoint-frontend.sh @@ -2,6 +2,6 @@ CONF="/etc/nginx/conf.d/default.conf" -[ -n "${ABRECHNUNG_API__HOST}" ] && sed -i "s/api:/${ABRECHNUNG_API__HOST}:/g" "$CONF" -[ -n "${ABRECHNUNG_API__PORT}" ] && sed -i "s/:8080/:${ABRECHNUNG_API__PORT}/g" "$CONF" -[ ! -f "/proc/net/if_inet6" ] && sed -i "s/listen \[::\]/#listen \[::\]/g" "$CONF" +[ -n "${ABRECHNUNG_API__HOST}" ] && sed -i "s/ api:/ ${ABRECHNUNG_API__HOST}:/g" "$CONF" +[ -n "${ABRECHNUNG_API__PORT}" ] && sed -i "s/:8080;/:${ABRECHNUNG_API__PORT};/g" "$CONF" +[ ! -f "/proc/net/if_inet6" ] && sed -i "s/ listen \[::\]/ #listen \[::\]/g" "$CONF"