修改config

This commit is contained in:
houhuan committed 2025-12-09 13:59:03 +08:00
1 parent 5e68d97127
commit 1890a8380b
4 files changed
+108 -23

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_URL=${1:-}
BRANCH=${2:-main}
REPO_DIR=${3:-.}
COMPOSE_FILE=${4:-docker-compose.yml}
BASE_URL=${5:-http://localhost:57778}
ADMIN_TOKEN=${6:-}
mkdir -p "$REPO_DIR"
if [ ! -d "$REPO_DIR/.git" ]; then
[ -z "$REPO_URL" ] && { echo "RepoUrl required"; exit 1; }
git clone -b "$BRANCH" "$REPO_URL" "$REPO_DIR"
fi
cd "$REPO_DIR"
git remote set-url origin "$REPO_URL"
git fetch origin
git checkout "$BRANCH"
git pull origin "$BRANCH"
[ -f "$COMPOSE_FILE" ] || { echo "compose not found: $COMPOSE_FILE"; exit 1; }
docker compose -f "$COMPOSE_FILE" up -d --build
HDR=( )
if [ -n "$ADMIN_TOKEN" ]; then HDR=( -H "X-Admin-Token: $ADMIN_TOKEN" ); fi
curl -s -X POST "${BASE_URL}/api/admin/reload_cutoff" "${HDR[@]}" || true
curl -s "${BASE_URL}/api/metrics" || true
curl -s -X POST "${BASE_URL}/api/admin/test_push" "${HDR[@]}" || true