fix: env
This commit is contained in:
@@ -16,6 +16,7 @@ fi
|
|||||||
if [ "$ENABLE_BASIC_AUTH" = "true" ]; then
|
if [ "$ENABLE_BASIC_AUTH" = "true" ]; then
|
||||||
echo "[entrypoint] Enabling basic authentication..."
|
echo "[entrypoint] Enabling basic authentication..."
|
||||||
if [ -f /etc/nginx/htpasswd ]; then
|
if [ -f /etc/nginx/htpasswd ]; then
|
||||||
|
# Use sed to append basic auth directives inside the location block
|
||||||
sed -i '/location \/ {/a \\t\tauth_basic "Restricted Content";\n\t\tauth_basic_user_file /etc/nginx/htpasswd;' /etc/nginx/http.d/default.conf
|
sed -i '/location \/ {/a \\t\tauth_basic "Restricted Content";\n\t\tauth_basic_user_file /etc/nginx/htpasswd;' /etc/nginx/http.d/default.conf
|
||||||
else
|
else
|
||||||
echo "[entrypoint] ERROR: htpasswd file not found at /etc/nginx/htpasswd" >&2
|
echo "[entrypoint] ERROR: htpasswd file not found at /etc/nginx/htpasswd" >&2
|
||||||
@@ -26,7 +27,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Test nginx configuration
|
# Test nginx configuration
|
||||||
nginx -t || { echo "[entrypoint] nginx config test failed" >&2; cat /var/log/nginx/error.log || true; exit 1; }
|
if ! nginx -t; then
|
||||||
|
echo "[entrypoint] nginx config test failed" >&2
|
||||||
|
cat /var/log/nginx/error.log || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Clear Laravel caches
|
# Clear Laravel caches
|
||||||
php artisan config:clear
|
php artisan config:clear
|
||||||
|
|||||||
Reference in New Issue
Block a user