#!/bin/sh
set -e

# 默认值：测试环境用 docker-compose 内的 service name
BACKEND_HOST=${BACKEND_HOST:-backend}

echo "[nginx] BACKEND_HOST=${BACKEND_HOST}"

sed "s|\${BACKEND_HOST}|${BACKEND_HOST}|g" /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf

exec "$@"
