From a3a383361d1718a4b1511143a8fd68100403953a Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 18 Feb 2026 07:53:08 -0500 Subject: [PATCH] [Fix] PatchMon: use `SERVER_PORT` in Nginx config if set in env (#12053) - This PR will add the ability to change the PatchMon listen port in the Nginx config during update, if the `SERVER_PORT` env var is set in `/opt/patchmon/backend.env` and if the port is not 443 - If not set, or if set and the port is 443, then no changes are made to the listen port in the Nginx config --- ct/patchmon.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ct/patchmon.sh b/ct/patchmon.sh index 1022d0bff..a65854faf 100644 --- a/ct/patchmon.sh +++ b/ct/patchmon.sh @@ -46,6 +46,7 @@ function update_script() { VERSION=$(get_latest_github_release "PatchMon/PatchMon") PROTO="$(sed -n '/SERVER_PROTOCOL/s/[^=]*=//p' /opt/backend.env)" HOST="$(sed -n '/SERVER_HOST/s/[^=]*=//p' /opt/backend.env)" + SERVER_PORT="$(sed -n '/SERVER_PORT/s/[^=]*=//p' /opt/backend.env)" [[ "${PROTO:-http}" == "http" ]] && PORT=":3001" sed -i 's/PORT=3399/PORT=3001/' /opt/backend.env sed -i -e "s/VERSION=.*/VERSION=$VERSION/" \ @@ -66,6 +67,9 @@ function update_script() { -e '\|try_files |i\ root /opt/patchmon/frontend/dist;' \ -e 's|alias.*|alias /opt/patchmon/frontend/dist/assets;|' \ -e '\|expires 1y|i\ root /opt/patchmon/frontend/dist;' /etc/nginx/sites-available/patchmon.conf + if [[ -n "$SERVER_PORT" ]] && [[ "$SERVER_PORT" != "443" ]]; then + sed -i "s/listen [[:digit:]]/listen ${SERVER_PORT};/" /etc/nginx/sites-available/patchmon.conf + fi ln -sf /etc/nginx/sites-available/patchmon.conf /etc/nginx/sites-enabled/ rm -f /etc/nginx/sites-enabled/default $STD nginx -t