diff --git a/backend/scripts/entrypoint.sh b/backend/scripts/entrypoint.sh index 58b5bc2..eb4c0d0 100644 --- a/backend/scripts/entrypoint.sh +++ b/backend/scripts/entrypoint.sh @@ -4,9 +4,22 @@ set -e # 遇到错误立即退出 -# 获取版本信息(从环境变量) -APP_VERSION="${APP_VERSION:-1.0.0}" -APP_NAME="${APP_NAME:-MuMuAINovel}" +# 获取版本信息(从 .env.example 文件) +# 如果环境变量未设置,则从 .env.example 读取 +if [ -z "$APP_VERSION" ]; then + if [ -f "/app/.env.example" ]; then + APP_VERSION=$(grep "^APP_VERSION=" /app/.env.example | cut -d '=' -f2) + fi + APP_VERSION="${APP_VERSION:-1.0.0}" +fi + +if [ -z "$APP_NAME" ]; then + if [ -f "/app/.env.example" ]; then + APP_NAME=$(grep "^APP_NAME=" /app/.env.example | cut -d '=' -f2) + fi + APP_NAME="${APP_NAME:-MuMuAINovel}" +fi + BUILD_TIME=$(date '+%Y-%m-%d %H:%M:%S') echo "================================================"