diff --git a/frontend/configureServer.sh b/frontend/configureServer.sh index 7b4cae38a..883d9579e 100644 --- a/frontend/configureServer.sh +++ b/frontend/configureServer.sh @@ -77,20 +77,35 @@ rm /etc/nginx/conf.d/default-ssl.conf # add the proxy pass and store the conf into the nginx conf directory sed -i -e "/# pathToApi/i\\ -proxy_pass $api_protocol://$api_host:$api_port;" /etc/nginx/conf.d/default.conf + proxy_pass $api_protocol://$api_host:$api_port;" /etc/nginx/conf.d/default.conf +# Loop through each line of the multi-line string and use sed to inject it +echo "$REACT_APP_API_SERVICE_ADDITIONAL_NGINX_CONF" | while IFS= read -r line; do + sed -i -e "/# pathToApi/i\\ + $line" /etc/nginx/conf.d/default.conf +done if [ "$REACT_APP_EXPORT_SERVICE_ENABLED" = true ]; then echo "Excel export has been enabled" echo "$export_protocol://$export_host:$export_port/" sed -i -e "/# pathToExcelExport/i\\ - proxy_pass $export_protocol://$export_host:$export_port/;" /etc/nginx/conf.d/default.conf + proxy_pass $export_protocol://$export_host:$export_port/;" /etc/nginx/conf.d/default.conf + # Loop through each line of the multi-line string and use sed to inject it + echo "$REACT_APP_EXPORT_SERVICE_ADDITIONAL_NGINX_CONF" | while IFS= read -r line; do + sed -i -e "/# pathToExcelExport/i\\ + $line" /etc/nginx/conf.d/default.conf + done fi if [ "$REACT_APP_EMAIL_SERVICE_ENABLED" = true ]; then echo "Email service has been enabled" echo "$email_protocol://$email_host:$email_port/" sed -i -e "/# pathToEmailService/i\\ - proxy_pass $email_protocol://$email_host:$email_port/;" /etc/nginx/conf.d/default.conf + proxy_pass $email_protocol://$email_host:$email_port/;" /etc/nginx/conf.d/default.conf + # Loop through each line of the multi-line string and use sed to inject it + echo "$REACT_APP_EMAIL_SERVICE_ADDITIONAL_NGINX_CONF" | while IFS= read -r line; do + sed -i -e "/# pathToEmailService/i\\ + $line" /etc/nginx/conf.d/default.conf + done fi if [[ ! -z "${REACT_APP_EXCHANGE_RATE_URL}" ]]; then @@ -102,7 +117,12 @@ fi sed -i -e "/# pathToStorageService/i\\ -proxy_pass $storage_service_protocol://$storage_service_host:$storage_service_port/download;" /etc/nginx/conf.d/default.conf + proxy_pass $storage_service_protocol://$storage_service_host:$storage_service_port/download;" /etc/nginx/conf.d/default.conf +# Loop through each line of the multi-line string and use sed to inject it +echo "$REACT_APP_STORAGE_SERVICE_ADDITIONAL_NGINX_CONF" | while IFS= read -r line; do + sed -i -e "/# pathToStorageService/i\\ + $line" /etc/nginx/conf.d/default.conf +done sed -i -e "s/^\(\s*include \/etc\/nginx\/sites-enabled\)/#&/" /etc/nginx/nginx.conf diff --git a/frontend/environment-variables.md b/frontend/environment-variables.md index 4fc671e0c..1b3ae55aa 100644 --- a/frontend/environment-variables.md +++ b/frontend/environment-variables.md @@ -16,6 +16,10 @@ | REACT_APP_AUTHPROXY_URL | `http://localhost:4000/signin` | auth proxy ingress. Required if REACT_APP_AUTHPROXY_ENABLED is set to true | | REACT_APP_APPLICATIONINSIGHTS_CONNECTION_STRING | _undefined_ | Azure Application Insights Connection String | | REACT_APP_POLLING_INTERVAL | 5000 | How often is data fetched from the server, in milliseconds. We recommend setting to 30000 (30 seconds), maybe longer if you experience performance issues. | +| REACT_APP_API_SERVICE_ADDITIONAL_NGINX_CONF | _undefined_ | Additional configuration of nginx server for api service. It could be a muti-line string. It will be injected to the nginx configuration. | +| REACT_APP_EMAIL_SERVICE_ADDITIONAL_NGINX_CONF | _undefined_ | Additional configuration of nginx server for email service. It could be a muti-line string. It will be injected to the nginx configuration. | +| REACT_APP_EXPORT_SERVICE_ADDITIONAL_NGINX_CONF | _undefined_ | Additional configuration of nginx server for excel export service. It could be a muti-line string. It will be injected to the nginx configuration. | +| REACT_APP_STORAGE_SERVICE_ADDITIONAL_NGINX_CONF | _undefined_ | Additional configuration of nginx server for storage service. It could be a muti-line string. It will be injected to the nginx configuration. | ### Email-Service diff --git a/scripts/operation/.env.example b/scripts/operation/.env.example index 668fae2f5..475edb352 100644 --- a/scripts/operation/.env.example +++ b/scripts/operation/.env.example @@ -126,6 +126,11 @@ REACT_APP_LOGGING_SERVICE_HOST_SSL=false REACT_APP_LOGGING_PUSH_INTERVAL=20 REACT_APP_APPLICATIONINSIGHTS_CONNECTION_STRING= REACT_APP_POLLING_INTERVAL=30000 +# could be a multi-line set of configuration for all variables ending "_ADDITIONAL_NGINX_CONF" +REACT_APP_API_SERVICE_ADDITIONAL_NGINX_CONF="" +REACT_APP_EMAIL_SERVICE_ADDITIONAL_NGINX_CONF="" +REACT_APP_EXPORT_SERVICE_ADDITIONAL_NGINX_CONF="" +REACT_APP_STORAGE_SERVICE_ADDITIONAL_NGINX_CONF="" ## excel-export ACCESS_CONTROL_ALLOW_ORIGIN=* diff --git a/scripts/operation/docker-compose.yml b/scripts/operation/docker-compose.yml index e01a83cbf..236785b0c 100644 --- a/scripts/operation/docker-compose.yml +++ b/scripts/operation/docker-compose.yml @@ -246,6 +246,10 @@ services: REACT_APP_EXCHANGE_RATE_URL: ${REACT_APP_EXCHANGE_RATE_URL} REACT_APP_APPLICATIONINSIGHTS_CONNECTION_STRING: ${REACT_APP_APPLICATIONINSIGHTS_CONNECTION_STRING} REACT_APP_POLLING_INTERVAL: ${REACT_APP_POLLING_INTERVAL} + REACT_APP_API_SERVICE_ADDITIONAL_NGINX_CONF: ${REACT_APP_API_SERVICE_ADDITIONAL_NGINX_CONF} + REACT_APP_EMAIL_SERVICE_ADDITIONAL_NGINX_CONF: ${REACT_APP_EMAIL_SERVICE_ADDITIONAL_NGINX_CONF} + REACT_APP_EXPORT_SERVICE_ADDITIONAL_NGINX_CONF: ${REACT_APP_EXPORT_SERVICE_ADDITIONAL_NGINX_CONF} + REACT_APP_STORAGE_SERVICE_ADDITIONAL_NGINX_CONF: ${REACT_APP_STORAGE_SERVICE_ADDITIONAL_NGINX_CONF} networks: mynetwork: ipv4_address: 172.21.0.91