Skip to content

Commit

Permalink
Update update_primary_nginx.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Barrera Novas authored and GitHub Enterprise committed Mar 4, 2025
1 parent 0d9e9bf commit 8d24724
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/update_primary_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ jobs:
- name: Check environment variables
run: env

- name: Ensure runner user has permission to modify Nginx config
run: |
sudo usermod -aG nginx $(whoami)
sudo chmod -R g+w /etc/nginx/conf.d/
- name: Escape Nginx variables
run: sed -i 's/\$http_host/\\$http_host/g; s/\$remote_addr/\\$remote_addr/g; s/\$proxy_add_x_forwarded_for/\\$proxy_add_x_forwarded_for/g' ./nginx_template.txt

- name: Substitute environment variables
run: envsubst '${PROD_PORT_PREFIX} ${GATEWAY_POSTFIX} ${DEV_PORT_PREFIX} ${STAG_PORT_PREFIX}' < ./nginx_template.txt > temp_default.conf

- name: Copy Nginx config to server
run: sudo cp temp_default.conf /etc/nginx/conf.d/default.conf
- name: Copy Nginx config to correct place
run: cp temp_default.conf /etc/nginx/conf.d/default.conf

- name: Show updated Nginx config
run: cat /etc/nginx/conf.d/default.conf
Expand Down

0 comments on commit 8d24724

Please sign in to comment.