Spaces:
Paused
Paused
fix: follow official cloud deployment guide - add DEPLOY=cloud env and --config flag
Browse files- config.yaml +14 -9
- entrypoint.sh +7 -8
config.yaml
CHANGED
|
@@ -1,9 +1,12 @@
|
|
| 1 |
-
# 绑定所有接口(HF Spaces 要求)
|
| 2 |
-
host: ""
|
| 3 |
-
|
| 4 |
# Server port
|
| 5 |
port: 8317
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Authentication directory
|
| 8 |
auth-dir: "/CLIProxyAPI/auth"
|
| 9 |
|
|
@@ -13,14 +16,16 @@ debug: true
|
|
| 13 |
# Write application logs to rotating files (false = stdout)
|
| 14 |
logging-to-file: false
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Legacy shorthand for inline API keys (Access Control)
|
| 26 |
api-keys:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Server port
|
| 2 |
port: 8317
|
| 3 |
|
| 4 |
+
# Remote management settings
|
| 5 |
+
remote-management:
|
| 6 |
+
allow-remote: true
|
| 7 |
+
secret-key: "sarky880309"
|
| 8 |
+
disable-control-panel: false
|
| 9 |
+
|
| 10 |
# Authentication directory
|
| 11 |
auth-dir: "/CLIProxyAPI/auth"
|
| 12 |
|
|
|
|
| 16 |
# Write application logs to rotating files (false = stdout)
|
| 17 |
logging-to-file: false
|
| 18 |
|
| 19 |
+
# Usage statistics
|
| 20 |
+
usage-statistics-enabled: false
|
| 21 |
|
| 22 |
+
# Request retry
|
| 23 |
+
request-retry: 3
|
| 24 |
|
| 25 |
+
# Quota exceeded behavior
|
| 26 |
+
quota-exceeded:
|
| 27 |
+
switch-project: true
|
| 28 |
+
switch-preview-model: true
|
| 29 |
|
| 30 |
# Legacy shorthand for inline API keys (Access Control)
|
| 31 |
api-keys:
|
entrypoint.sh
CHANGED
|
@@ -3,6 +3,9 @@
|
|
| 3 |
|
| 4 |
CONFIG="/CLIProxyAPI/config.yaml"
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
# 注入 API Keys(逗号分隔的多个 key)
|
| 7 |
if [ -n "$API_KEYS" ]; then
|
| 8 |
sed -i '/^api-keys:/,/^[^ #-]/{ /^api-keys:/!{ /^[^ #-]/!d } }' "$CONFIG"
|
|
@@ -14,13 +17,9 @@ if [ -n "$API_KEYS" ]; then
|
|
| 14 |
done
|
| 15 |
fi
|
| 16 |
|
| 17 |
-
# 管理面板密钥
|
| 18 |
-
# 文档说明: "Setting the MANAGEMENT_PASSWORD env var registers an additional
|
| 19 |
-
# plaintext management secret and forces remote management to stay enabled."
|
| 20 |
-
# 这种方式直接在内存中注册密钥,不写入 config.yaml,避免 bcrypt 哈希写回问题
|
| 21 |
if [ -n "$MANAGEMENT_KEY" ]; then
|
| 22 |
-
|
| 23 |
-
echo "[entrypoint] MANAGEMENT_PASSWORD is set from MANAGEMENT_KEY"
|
| 24 |
fi
|
| 25 |
|
| 26 |
# 注入代理 URL
|
|
@@ -53,5 +52,5 @@ echo "=== Final config.yaml ==="
|
|
| 53 |
cat "$CONFIG"
|
| 54 |
echo "========================="
|
| 55 |
|
| 56 |
-
#
|
| 57 |
-
exec /CLIProxyAPI/CLIProxyAPI "$
|
|
|
|
| 3 |
|
| 4 |
CONFIG="/CLIProxyAPI/config.yaml"
|
| 5 |
|
| 6 |
+
# 设置云部署模式(官方文档要求)
|
| 7 |
+
export DEPLOY=cloud
|
| 8 |
+
|
| 9 |
# 注入 API Keys(逗号分隔的多个 key)
|
| 10 |
if [ -n "$API_KEYS" ]; then
|
| 11 |
sed -i '/^api-keys:/,/^[^ #-]/{ /^api-keys:/!{ /^[^ #-]/!d } }' "$CONFIG"
|
|
|
|
| 17 |
done
|
| 18 |
fi
|
| 19 |
|
| 20 |
+
# 注入管理面板密钥到 config.yaml 的 remote-management.secret-key
|
|
|
|
|
|
|
|
|
|
| 21 |
if [ -n "$MANAGEMENT_KEY" ]; then
|
| 22 |
+
sed -i "s|secret-key:.*|secret-key: \"$MANAGEMENT_KEY\"|" "$CONFIG"
|
|
|
|
| 23 |
fi
|
| 24 |
|
| 25 |
# 注入代理 URL
|
|
|
|
| 52 |
cat "$CONFIG"
|
| 53 |
echo "========================="
|
| 54 |
|
| 55 |
+
# 使用 --config 参数指定配置文件路径(官方云部署方式)
|
| 56 |
+
exec /CLIProxyAPI/CLIProxyAPI --config "$CONFIG"
|