state.rs 1.1 KB

1234567891011121314151617181920212223
  1. use bos_platform::clients::{uds::UdsClient, PlatformClient};
  2. use bos_scope::DbScopedSelect;
  3. use std::sync::Arc;
  4. #[derive(Clone)]
  5. pub struct AppState {
  6. /// 数据出入口:一律经 SEOH UDS,⛔ 自持数据库凭据直连。
  7. pub db: Arc<UdsClient>,
  8. pub platform: Arc<PlatformClient>,
  9. pub scope: Arc<DbScopedSelect>,
  10. pub bos_env: String,
  11. pub service_name: String,
  12. /// 本项目的项目空间 ID = 平台 `scope_type='end_user'` 的 `scope_id`。
  13. /// 建号类接口(`iam-user/user/create@v1`)必须自带作用域三元组,平台侧
  14. /// `ensure_end_user_env_stage` 缺一即 `11103` ⇒ BOS 无从由 JWT 之外的途径取得。
  15. pub project_id: String,
  16. /// 租户 ID(`uds.tenant_id`):平台 SJC/UME 的 `tenant_id` 必填项,
  17. /// UDS 数据面已用它拼 `uds.<schema>.<table>`,此处只供平台调度/消息面复用。
  18. pub tenant_id: String,
  19. /// 数据面环境二元组(`nonprod|prod` + `dev|test|prod`),与 UDS 取数同一口径。
  20. pub data_env: String,
  21. pub seoh_env: String,
  22. }