This commit is contained in:
zyp
2026-11-18 16:01:50 +08:00
parent 0dc48ad092
commit 0c3d0c1ce4
30 changed files with 1525 additions and 93 deletions
+13
View File
@@ -61,6 +61,7 @@ class Settings(BaseSettings):
app_name: str = "Company AI Management Platform"
app_env: str = "local"
app_mode: Literal["platform", "work-assistant"] = "platform"
debug: bool = False
read_only_mode: bool = True
api_prefix: str = "/api/v1"
@@ -316,6 +317,18 @@ class Settings(BaseSettings):
def validate_production_safety(self) -> "Settings":
if self.app_env.lower() not in {"prod", "production"}:
return self
if self.app_mode == "work-assistant":
# The standalone bridge has its own authentication and local state;
# it does not start the platform database, audit API or schedulers.
errors: list[str] = []
secret = self.work_assistant_shared_secret or ""
if len(secret.strip()) < 32 or _is_unsafe_production_secret(secret):
errors.append("WORK_ASSISTANT_SHARED_SECRET must be a non-placeholder value of at least 32 characters")
if self.debug:
errors.append("DEBUG must be false in production")
if errors:
raise ValueError("; ".join(errors))
return self
def _enabled_keys(
legacy_key: str | None,
configured_keys: list[dict[str, Any]],