From e40be2f2e728acf641b5c4e7d886921acbc24c6e Mon Sep 17 00:00:00 2001 From: Constantine Karnaukhov Date: Tue, 24 Mar 2020 11:44:07 +0400 Subject: [PATCH] fix(nginx): check `fastcgi_read_timeout` directive not exist before adding --- spaceonfire/bin/entrypoint.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spaceonfire/bin/entrypoint.sh b/spaceonfire/bin/entrypoint.sh index 79902e6..6d42340 100644 --- a/spaceonfire/bin/entrypoint.sh +++ b/spaceonfire/bin/entrypoint.sh @@ -40,10 +40,13 @@ if [[ -z "$NGINX_READ_TIMEOUT" ]] && [[ "$APPLICATION_ENV" != "production" ]]; t fi if [[ ! -z "$NGINX_READ_TIMEOUT" ]]; then - { - echo "" - echo "fastcgi_read_timeout $NGINX_READ_TIMEOUT;" - } >> /etc/nginx/fastcgi_params + FastCgiParamsFile="/etc/nginx/fastcgi_params" + if ! grep -q fastcgi_read_timeout "$FastCgiParamsFile"; then + { + echo "" + echo "fastcgi_read_timeout $NGINX_READ_TIMEOUT;" + } >> $FastCgiParamsFile + fi fi # Prevent config files from being filled to infinity by force of stop and restart the container