fix: 修正访问控制与插件契约

This commit is contained in:
chuan
2026-08-15 17:17:08 +08:00
parent 660d215a06
commit 072ed8f168
19 changed files with 180 additions and 410 deletions
+8 -3
View File
@@ -6,9 +6,14 @@ bash "$root/scripts/check-env.sh"
cd "$root"
mkdir -p bin
gofmt -w cmd internal
go mod tidy
go test ./...
unformatted="$(gofmt -l cmd internal)"
if [[ -n "$unformatted" ]]; then
echo '以下 Go 文件尚未格式化:' >&2
echo "$unformatted" >&2
exit 1
fi
go list -mod=readonly ./... >/dev/null
CGO_ENABLED=1 go test ./...
CGO_ENABLED=1 go build -tags cshared -buildmode=c-shared -o bin/cpa-ext.so ./cmd/cpa-ext
echo "Built: $root/bin/cpa-ext.so"
+11 -4
View File
@@ -3,8 +3,9 @@ set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
runtime="$root/.runtime"
pid_file="$runtime/cliproxy.pid"
log_file="$runtime/cliproxy.log"
binary="$runtime/bin/cli-proxy-api"
pid_file="$runtime/cpa.pid"
log_file="$runtime/logs/cpa-console.log"
if [[ -f "$pid_file" ]]; then
old_pid="$(cat "$pid_file" || true)"
@@ -14,9 +15,15 @@ if [[ -f "$pid_file" ]]; then
fi
fi
mkdir -p "$runtime/auths" "$runtime/plugins"
if [[ ! -x "$binary" ]]; then
echo "CPA test host binary not found: $binary" >&2
exit 1
fi
mkdir -p "$runtime/auths" "$runtime/plugins" "$runtime/logs"
: >"$log_file"
nohup "$runtime/cliproxy" -config "$runtime/config.yaml" \
cd "$runtime"
nohup "$binary" --config "$runtime/config.yaml" \
>"$log_file" 2>&1 </dev/null &
pid=$!
echo "$pid" >"$pid_file"
+1 -1
View File
@@ -2,7 +2,7 @@
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
pid_file="$root/.runtime/cliproxy.pid"
pid_file="$root/.runtime/cpa.pid"
if [[ ! -f "$pid_file" ]]; then
echo 'CPA test host is not running.'