From 90d2b5d9b553f0e16bdcbfbf579b13223f4fa80b Mon Sep 17 00:00:00 2001 From: Colin Copeland Date: Tue, 9 Jan 2024 09:36:57 -0500 Subject: [PATCH] add ENKETO_URL and SERVICE_URL Co-authored-by: Tobias McNulty --- docker-compose.yml | 2 ++ files/nginx/odk.conf.template | 4 ++-- files/nginx/setup-odk.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index da4f6fa0..ed3460e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,8 @@ services: - enketo environment: - DOMAIN=${DOMAIN} + - ENKETO_URL=${ENKETO_URL:-http://enketo:8005} + - SERVICE_URL=${SERVICE_URL:-http://service:8383} - CERTBOT_EMAIL=${SYSADMIN_EMAIL} - SSL_TYPE=${SSL_TYPE:-letsencrypt} - SENTRY_ORG_SUBDOMAIN=${SENTRY_ORG_SUBDOMAIN:-o130137} diff --git a/files/nginx/odk.conf.template b/files/nginx/odk.conf.template index 65ceea35..3803a949 100644 --- a/files/nginx/odk.conf.template +++ b/files/nginx/odk.conf.template @@ -25,7 +25,7 @@ server { gzip_types text/plain text/css application/json application/x-javascript text/xml text/csv; location /- { - proxy_pass http://enketo:8005; + proxy_pass ${ENKETO_URL}; proxy_redirect off; proxy_set_header Host $host; @@ -46,7 +46,7 @@ server { location ~ ^/v\d { proxy_set_header X-Forwarded-Proto $scheme; - proxy_pass http://service:8383; + proxy_pass ${SERVICE_URL}; proxy_redirect off; # buffer requests, but not responses, so streaming out works. diff --git a/files/nginx/setup-odk.sh b/files/nginx/setup-odk.sh index 8e813a1d..32fd9718 100644 --- a/files/nginx/setup-odk.sh +++ b/files/nginx/setup-odk.sh @@ -19,7 +19,7 @@ fi echo "writing fresh nginx templates..." cp /usr/share/odk/nginx/redirector.conf /etc/nginx/conf.d/redirector.conf CNAME=$( [ "$SSL_TYPE" = "customssl" ] && echo "local" || echo "$DOMAIN") \ -envsubst '$SSL_TYPE $CNAME $SENTRY_ORG_SUBDOMAIN $SENTRY_KEY $SENTRY_PROJECT' \ +envsubst '$SSL_TYPE $CNAME $SENTRY_ORG_SUBDOMAIN $SENTRY_KEY $SENTRY_PROJECT $ENKETO_URL $SERVICE_URL' \ < /usr/share/odk/nginx/odk.conf.template \ > /etc/nginx/conf.d/odk.conf