feat: execute upstream nginx entrypoint

This commit is contained in:
Nicolas Duchon 2024-05-04 20:47:07 +02:00
parent 2ac4509a61
commit f1f395c10b
No known key found for this signature in database
GPG key ID: EA3151C66A4D79E7
4 changed files with 23 additions and 1 deletions

View file

@ -110,12 +110,17 @@ if [[ $* == 'forego start -r' ]]; then
_setup_dhparam _setup_dhparam
if [ -z "${TRUST_DOWNSTREAM_PROXY}" ]; then if [[ -z "${TRUST_DOWNSTREAM_PROXY}" ]]; then
cat >&2 <<-EOT cat >&2 <<-EOT
Warning: TRUST_DOWNSTREAM_PROXY is not set; defaulting to "true". For security, you should explicitly set TRUST_DOWNSTREAM_PROXY to "false" if there is not a trusted reverse proxy in front of this proxy. Warning: TRUST_DOWNSTREAM_PROXY is not set; defaulting to "true". For security, you should explicitly set TRUST_DOWNSTREAM_PROXY to "false" if there is not a trusted reverse proxy in front of this proxy.
Warning: The default value of TRUST_DOWNSTREAM_PROXY might change to "false" in a future version of nginx-proxy. If you require TRUST_DOWNSTREAM_PROXY to be enabled, explicitly set it to "true". Warning: The default value of TRUST_DOWNSTREAM_PROXY might change to "false" in a future version of nginx-proxy. If you require TRUST_DOWNSTREAM_PROXY to be enabled, explicitly set it to "true".
EOT EOT
fi fi
# Execute upstream nginx entrypoint if present
if [[ -f /docker-entrypoint.sh ]]; then
/docker-entrypoint.sh nginx -v
fi
fi fi
exec "$@" exec "$@"

View file

@ -0,0 +1 @@
# some_directive ${TEST_VARIABLE};

View file

@ -0,0 +1,6 @@
import pytest
def test_templatefile_was_rendered_by_nginx_entrypoint(docker_compose, nginxproxy):
conf = nginxproxy.get_conf().decode('ASCII')
assert "# some_directive FOOBARBAZ;" in conf

View file

@ -0,0 +1,10 @@
version: "2"
services:
sut:
image: nginxproxy/nginx-proxy:test
environment:
TEST_VARIABLE: "FOOBARBAZ"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./test.conf.template:/etc/nginx/templates/test.conf.template:ro