From fbff92403f4fe36ee77bef8c7ec99eb79f738e75 Mon Sep 17 00:00:00 2001 From: Michael Manganiello Date: Wed, 19 Feb 2025 01:02:25 -0300 Subject: [PATCH] feat: Allow configuring app port using ROMM_PORT environment variable By using the `ROMM_PORT` environment variable, users can now configure the port on which the application listens, which defaults to `8080`. --- docker/init_scripts/docker-entrypoint.sh | 5 +++++ docker/nginx/templates/default.conf.template | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/init_scripts/docker-entrypoint.sh b/docker/init_scripts/docker-entrypoint.sh index cad1086c8..9957dd088 100755 --- a/docker/init_scripts/docker-entrypoint.sh +++ b/docker/init_scripts/docker-entrypoint.sh @@ -33,6 +33,11 @@ for var_name in $(printenv | cut -d= -f1 | grep "_FILE$" || true); do unset "${var_name}" done +# Set default values for environment variables used by nginx templates. +# Nginx uses `envsubst` to load environment variables into configuration files, but it does not +# support the default value syntax `${VAR:-default}`. +: "${ROMM_PORT:=8080}" + # Replace environment variables used in nginx configuration templates. /docker-entrypoint.d/20-envsubst-on-templates.sh >/dev/null diff --git a/docker/nginx/templates/default.conf.template b/docker/nginx/templates/default.conf.template index 7829b9303..30e1e1e4c 100644 --- a/docker/nginx/templates/default.conf.template +++ b/docker/nginx/templates/default.conf.template @@ -4,7 +4,7 @@ server { root /var/www/html; - listen 8080; + listen ${ROMM_PORT}; server_name localhost; proxy_set_header Host $http_host;