#!/bin/sh
# Generate nginx config with blazor-environment header
# BLAZOR_ENVIRONMENT defaults to "Staging" if not set
BLAZOR_ENV="${BLAZOR_ENVIRONMENT:-Staging}"

cat > /etc/nginx/conf.d/default.conf <<NGINX_CONF
server {
    listen 80;
    server_name _;
    location / {
        root /usr/share/nginx/html;
        try_files \$uri \$uri/ /index.html;
        add_header blazor-environment $BLAZOR_ENV;
    }
}
NGINX_CONF

exec nginx -g 'daemon off;'
