multiple configs depending on wether or not we have cert

This commit is contained in:
2025-11-20 21:46:20 +00:00
parent 8c2b99d65f
commit d8aa357414
6 changed files with 78 additions and 24 deletions

14
nginx/entrypoint.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
set -e
# Check if certificate exists
if [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then
echo "Certificates found. Using production nginx config."
envsubst '$BACKEND_HOST $DOMAIN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
else
echo "Certificates NOT found. Using setup nginx config."
envsubst '$BACKEND_HOST $DOMAIN' < /etc/nginx/nginx_setup.conf.template > /etc/nginx/nginx.conf
fi
# Start nginx
nginx -g 'daemon off;'