Skip to content
Snippets Groups Projects
Commit 4e6aa60c authored by Eric Frias's avatar Eric Frias
Browse files

Disable the postgrest rewriter's nginx http_rewrite engine logs by default,

allow them to be enabled by an environment variable REWRITE_LOG=ON
parent 04c86458
No related branches found
No related tags found
3 merge requests!168Update return types: VEST balances should be returned as strings to address JSON limitations,!149merge develop to master for release,!123Disable the postgrest rewriter's nginx http_rewrite engine logs by default,
Pipeline #109344 passed
FROM openresty/openresty:alpine AS without_tag
COPY docker/balance_tracker_nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY docker/balance_tracker_nginx.conf.template /usr/local/openresty/nginx/conf/nginx.conf.template
COPY docker/rewriter_entrypoint.sh /entrypoint.sh
COPY rewrite_rules.conf /usr/local/openresty/nginx/conf/rewrite_rules.conf
CMD ["/entrypoint.sh"]
ARG BUILD_TIME
ARG GIT_COMMIT_SHA
ARG GIT_CURRENT_BRANCH
......
......@@ -16,7 +16,10 @@ http {
location / {
include rewrite_rules.conf;
rewrite_log on;
# ${REWRITE_LOG} will be replaced by the docker entrypoint script.
# Set REWRITE_LOG=on in the environment to enable rewrite logging,
# otherwise it will remain disabled
${REWRITE_LOG}
proxy_pass http://balance-tracker-postgrest:3000; # my PostREST is here!
......
#!/bin/sh
# Default value for REWRITE_LOG is off, unless explicitly set to 'on'
if [ "$REWRITE_LOG" = "on" ]; then
REWRITE_LOG="rewrite_log on;"
else
REWRITE_LOG="# rewrite_log off;"
fi
# Use sed to replace the placeholder in the nginx template file
sed "s|\${REWRITE_LOG}|$REWRITE_LOG|g" /usr/local/openresty/nginx/conf/nginx.conf.template > /usr/local/openresty/nginx/conf/nginx.conf
# Start nginx
/usr/local/openresty/bin/openresty -g 'daemon off;'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment