中控 Bridge Token 为空时自动生成,Origin 改为选填说明。
打开 env 配置或首次部署即可写入 Token,便于复制到中控登记。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
- FLASK_SECRET_KEY
|
||||
- APP_USERNAME=admin / APP_PASSWORD=admin123(仅空时)
|
||||
- HUB_BRIDGE_TOKEN(仅空时,供中控对接)
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -47,6 +48,9 @@ def main() -> int:
|
||||
if (cur_pass or "").strip() in PASSWORD_PLACEHOLDERS:
|
||||
updates["APP_PASSWORD"] = "admin123"
|
||||
|
||||
if not (env_get(lines, "HUB_BRIDGE_TOKEN") or "").strip():
|
||||
updates["HUB_BRIDGE_TOKEN"] = secrets.token_urlsafe(32)
|
||||
|
||||
if not updates:
|
||||
print(" 密钥已存在,无需写入")
|
||||
return 0
|
||||
@@ -54,7 +58,11 @@ def main() -> int:
|
||||
print(f" 将更新 {env_path}: {', '.join(updates.keys())}")
|
||||
if args.dry_run:
|
||||
for k, v in updates.items():
|
||||
shown = v if k != "APP_PASSWORD" and "SECRET" not in k else "***"
|
||||
shown = (
|
||||
"***"
|
||||
if k in ("APP_PASSWORD", "HUB_BRIDGE_TOKEN") or "SECRET" in k
|
||||
else v
|
||||
)
|
||||
print(f" {k}={shown}")
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user