fix: 修复启动文件报错问题

This commit is contained in:
Daniel
2026-04-07 17:09:46 +08:00
parent 2dace0c21a
commit 30c6896537
2 changed files with 22 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ APT_MIRROR=mirrors.aliyun.com
PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
PIP_TRUSTED_HOST=mirrors.aliyun.com
AUTO_PULL_LATEST=true
AUTO_PULL_LATEST=false
GIT_REPO_URL=
GIT_BRANCH=master
GIT_CLONE_DEPTH=1

View File

@@ -22,6 +22,27 @@ fi
PORT=$(grep '^EDGE_DISPATCH_PORT=' .env | tail -n1 | cut -d'=' -f2- || true)
PORT="${PORT:-8060}"
# AUTO_PULL_LATEST=true requires GIT_REPO_URL. If empty, fallback to local source build.
AUTO_PULL="$(grep '^AUTO_PULL_LATEST=' .env | tail -n1 | cut -d'=' -f2- || true)"
AUTO_PULL="${AUTO_PULL:-true}"
GIT_REPO_URL_VAL="$(grep '^GIT_REPO_URL=' .env | tail -n1 | cut -d'=' -f2- || true)"
if [ "$AUTO_PULL" = "true" ] && [ -z "$GIT_REPO_URL_VAL" ]; then
if [ -d "${ROOT_DIR}/.git" ]; then
REPO_FROM_GIT="$(git -C "$ROOT_DIR" config --get remote.origin.url || true)"
else
REPO_FROM_GIT=""
fi
if [ -n "$REPO_FROM_GIT" ]; then
echo "[WARN] GIT_REPO_URL empty; use git remote origin: $REPO_FROM_GIT"
export GIT_REPO_URL="$REPO_FROM_GIT"
else
echo "[WARN] GIT_REPO_URL empty; fallback AUTO_PULL_LATEST=false (build from local source)"
export AUTO_PULL_LATEST=false
fi
fi
docker compose up -d --build
echo "[OK] center dispatch started"
echo "[INFO] health: curl http://127.0.0.1:${PORT}/health"