Files
datahub/deploy/podman/images/frontend/docker-entrypoint.sh
T
2026-05-11 10:41:36 +08:00

23 lines
624 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# 由 nginx 官方镜像的入口脚本自动执行(位于 /docker-entrypoint.d/
# 将 config.js 中的占位符替换为运行期环境变量
set -e
CONFIG_FILE=/usr/share/nginx/html/config.js
if [ ! -f "$CONFIG_FILE" ]; then
echo "[entrypoint] $CONFIG_FILE 不存在,跳过注入" >&2
exit 0
fi
if [ -z "${API_BASE_URL:-}" ]; then
echo "[entrypoint] 错误:必须设置 API_BASE_URL 环境变量" >&2
exit 1
fi
# 用 | 作分隔符,避免 URL 里的 / 干扰
sed -i "s|__API_BASE_URL__|${API_BASE_URL}|g" "$CONFIG_FILE"
echo "[entrypoint] 已注入 API_BASE_URL=${API_BASE_URL}"