Add hub AI config tab with sync to instances and deploy secret bootstrap.

Wire bootstrap_deploy_secrets into setup_env.sh (one-time HUB_BRIDGE_TOKEN, FLASK_SECRET_KEY, HUB_SESSION_SECRET). Remove AI section from instance env UI; hub saves OPENAI settings to all four .env files. SSO unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-08 22:50:58 +08:00
parent 886f7740f2
commit 823aeda42a
17 changed files with 653 additions and 54 deletions
+17
View File
@@ -8,6 +8,11 @@ from pathlib import Path
from typing import Any
from lib.env.env_file_lib import apply_env_updates, load_env_file_into_environ
from lib.env.shared_env_lib import (
apply_ai_env_to_all,
build_ai_env_payload,
restart_hub_and_instances_pm2,
)
HUB_DIR = Path(__file__).resolve().parent
@@ -27,6 +32,18 @@ def update_hub_credentials(*, new_password: str, new_username: str | None = None
return changed
def get_hub_ai_env_payload() -> dict[str, Any]:
return build_ai_env_payload(hub_env_path())
def save_hub_ai_env(updates: dict[str, str]) -> dict[str, Any]:
return apply_ai_env_to_all(updates)
def restart_all_pm2() -> dict[str, Any]:
return restart_hub_and_instances_pm2()
def restart_hub_pm2() -> dict[str, Any]:
app_name = (os.getenv("PM2_APP_NAME") or "").strip() or "manual-trading-hub"
if not sys.platform.startswith("linux"):