From b556f85a53fad174da4c805360f01ede888a8122 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 14 Apr 2026 11:37:07 -0400 Subject: [PATCH] chore(nginx): use environment variables for `gunicorn` --- config/root/etc/nginx/nginx.conf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/root/etc/nginx/nginx.conf b/config/root/etc/nginx/nginx.conf index 85ecbfef..eed42ad9 100644 --- a/config/root/etc/nginx/nginx.conf +++ b/config/root/etc/nginx/nginx.conf @@ -9,6 +9,10 @@ worker_processes auto; worker_cpu_affinity auto; pid /run/nginx.pid; +# gunicorn +env LISTEN_HOST; +env LISTEN_PORT; + # link configuration env CIPHERSERVER_PORT_8001_TCP_ADDR; env CIPHERSERVER_PORT_8001_TCP_PORT; @@ -130,7 +134,17 @@ http { # Authentication and proxying location / { - proxy_pass http://127.0.0.1:8080; + # gunicorn host + set_by_lua_block $gunicorn_host { + return os.getenv('LISTEN_HOST') or '127.0.0.1' + } + + # gunicorn port + set_by_lua_block $gunicorn_port { + return os.getenv('LISTEN_PORT') or '8080' + } + + proxy_pass http://$gunicorn_host:$gunicorn_port; proxy_set_header Host localhost:$proxy_port; proxy_set_header X-Forwarded-Host $x_forwarded_host; proxy_set_header X-Forwarded-Port $x_forwarded_port;