diff --git a/scripts/svc.sh b/scripts/svc.sh index d8d1ab66..9993537a 100755 --- a/scripts/svc.sh +++ b/scripts/svc.sh @@ -1534,6 +1534,12 @@ svc_launch_serve() { if [ -n "${RDM_DISABLE_EXEC_TOOLS:-}" ]; then args+=("RDM_DISABLE_EXEC_TOOLS=$RDM_DISABLE_EXEC_TOOLS") fi + # 超级管理员凭据只从本次环境转发,不写入 serve.env;缺失时由 serve 自行 fail closed。 + for k in SUPER_ADMIN_OWNER SUPER_ADMIN_PASSWORD AGENT_SYSTEM_ENV_FILE; do + if [ -n "${!k+x}" ]; then + args+=("$k=${!k}") + fi + done # shellcheck disable=SC2086 nohup "${args[@]}" "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 9>&- & } diff --git a/tests/integration/lifecycle/test_lifecycle_real.py b/tests/integration/lifecycle/test_lifecycle_real.py index d0569726..c9902eb6 100644 --- a/tests/integration/lifecycle/test_lifecycle_real.py +++ b/tests/integration/lifecycle/test_lifecycle_real.py @@ -86,6 +86,8 @@ class LifecycleRealTests(tsr.SvcAutoRecoverTests): def initialize_store(self, data, env=None): init_env = dict(self.env if env is None else env) init_env["RDM_DISABLE_EXEC_TOOLS"] = "1" + init_env.setdefault("SUPER_ADMIN_OWNER", "superadmin") + init_env.setdefault("SUPER_ADMIN_PASSWORD", "realcombo-super-admin-password") if env is None: init_env.pop("AGENT_SYSTEM_DSN", None) with socket.socket() as sock: @@ -95,7 +97,7 @@ class LifecycleRealTests(tsr.SvcAutoRecoverTests): with log_path.open("wb") as log: proc = subprocess.Popen( [str(self.real_bin), "serve", "--addr", "127.0.0.1:%d" % port, - "--data", str(data), "--auth", "on"], + "--data", str(data), "--auth", "auto"], cwd=self.root, env=init_env, stdout=log, stderr=log) try: for _ in range(200): diff --git a/tests/test_svc_realcombo.py b/tests/test_svc_realcombo.py index ea1971d0..2eaf13c4 100644 --- a/tests/test_svc_realcombo.py +++ b/tests/test_svc_realcombo.py @@ -121,6 +121,8 @@ class RealComboTests(tsr.SvcAutoRecoverTests): """ init_env = dict(self.env if env is None else env) init_env["RDM_DISABLE_EXEC_TOOLS"] = "1" + init_env.setdefault("SUPER_ADMIN_OWNER", "superadmin") + init_env.setdefault("SUPER_ADMIN_PASSWORD", "realcombo-super-admin-password") if env is None: init_env.pop("AGENT_SYSTEM_DSN", None) with socket.socket() as sock: @@ -130,7 +132,7 @@ class RealComboTests(tsr.SvcAutoRecoverTests): with log_path.open("wb") as log: proc = subprocess.Popen( [str(binary), "serve", "--addr", "127.0.0.1:%d" % port, - "--data", str(data), "--auth", "on"], + "--data", str(data), "--auth", "auto"], cwd=self.root, env=init_env, stdout=log, stderr=log) try: for _ in range(200):