From e752a8528e6f52652388441197182dc8ff3d344b Mon Sep 17 00:00:00 2001 From: Bernd Schorgers Date: Tue, 14 Jan 2025 18:28:39 +0100 Subject: [PATCH] feat: Allow configuring HTTP_PORT and HTTP_WORKERS --- docker/entrypoint.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index d4f3fc73..b17a2253 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,12 +1,21 @@ #!/bin/sh -if [ -z "$BACKEND_HOSTNAME" ]; then +if [ -z "${BACKEND_HOSTNAME}" ]; then echo "BACKEND_HOSTNAME not set" exit 1 fi HTTP_MODE=${HTTP_MODE:-https} -sed -i s@https://pipedapi.kavin.rocks@"$HTTP_MODE"://pipedapi.kavin.rocks@g /usr/share/nginx/html/assets/* -sed -i s/pipedapi.kavin.rocks/"$BACKEND_HOSTNAME"/g /usr/share/nginx/html/assets/* +sed -i "s@https://pipedapi.kavin.rocks@${HTTP_MODE}://pipedapi.kavin.rocks@g" /usr/share/nginx/html/assets/* +sed -i "s/pipedapi.kavin.rocks/${BACKEND_HOSTNAME}/g" /usr/share/nginx/html/assets/* + +if [ -n "${HTTP_WORKERS}" ]; then + sed -i "s/worker_processes auto;/worker_processes ${HTTP_WORKERS};/g" /etc/nginx/nginx.conf +fi + +if [ -n "${HTTP_PORT}" ]; then + sed -i "s/80;/${HTTP_PORT};/g" /etc/nginx/conf.d/default.conf +fi + nginx -g "daemon off;"