Skip to content

Commit

Permalink
Add correct logic for new templated nginx file (#155)
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
gerrod3 authored Apr 5, 2024
1 parent 804981c commit 75ee4c1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions base/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ create_super_user() {

set_nginx_port() {
echo "setting nginx port"
# the nginx s6 service copies the file from /nginx/nginx.conf, which overwrites our changes,
# so we have to change the source file.
/usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf
/usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/ssl_nginx.conf
# the nginx s6 service templates/copies the file from /nginx/nginx.conf.j2;/nginx/nginx.conf,
# which overwrites our changes, so we have to change the source file.
if [[ -f /nginx/nginx.conf ]]; then
/usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf
/usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/ssl_nginx.conf
fi
if [[ -f /nginx/nginx.conf.j2 ]]; then
/usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf.j2
/usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/nginx.conf.j2
fi

# this is the older command. Leaving this in for backwards compatibility for devs that haven't
# updated their images.
Expand Down

0 comments on commit 75ee4c1

Please sign in to comment.