From edf100b403ed09144f2bab22d6eb05b781fd0110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauritz=20Skog=C3=B8y?= Date: Tue, 4 Mar 2025 11:18:45 +0100 Subject: [PATCH] Try again please --- .github/workflows/update_primary_nginx.yml | 29 ++++++++++++++-------- nginx_template.txt | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update_primary_nginx.yml b/.github/workflows/update_primary_nginx.yml index 3836d92..7906f2f 100644 --- a/.github/workflows/update_primary_nginx.yml +++ b/.github/workflows/update_primary_nginx.yml @@ -14,22 +14,31 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up environment variables - uses: falti/dotenv-action@v1.1.4 - with: - export-variables: true - keys-case: bypass - - # Copying nginx configuration file to the server - - name: Deploy nginx configuration file + - name: Export environment variables run: | - sudo cp ./nginx_secfit.conf /etc/nginx/conf.d/nginx.conf + export URL_PREFIX=http:// + export PORT_PREFIX=2 + export DEV_POSTFIX=1 + export STAG_POSTFIX=2 + export PROD_POSTFIX=3 + export DEV_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${DEV_POSTFIX} + export STAG_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${STAG_POSTFIX} + export PROD_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${PROD_POSTFIX} + + - name: Replace environment variables in Nginx config + run: | + envsubst < nginx_template > nginx.conf - # Test the nginx configuration + # Test the nginx configuration - name: Test nginx configuration file run: | sudo nginx -t + # Copying nginx configuration file to the server + - name: Deploy nginx configuration file + run: | + sudo cp ./nginx_secfit.conf /etc/nginx/conf.d/nginx.conf + # Restarting nginx service - name: Restart nginx service run: | diff --git a/nginx_template.txt b/nginx_template.txt index 6ff2deb..26926ed 100644 --- a/nginx_template.txt +++ b/nginx_template.txt @@ -12,7 +12,7 @@ server { server { listen ${DEV_PORT_PREFIX}7; location / { - proxy_pass http://0.0.0.0:${DEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; + proxy_pass http://0.0.0.0:${envDEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;