chore(env): expose tenant RBAC + per-user tenant cap as env knobs

Surface two existing config.go env overrides to the canonical
deployment artifacts so operators can flip them without reading the
Go source:

* WEKNORA_TENANT_ENABLE_RBAC — observe / enforce switch for
  tenant-level role enforcement (PR 1303). Default false keeps the
  current behaviour; flip to true once role assignments have been
  audited per docs/rbac.md.
* WEKNORA_TENANT_MAX_OWNED_PER_USER — cap on tenants a single
  non-superuser can self-create. Uses the existing <0 / 0 / >0
  sentinel semantics documented on TenantConfig.MaxOwnedPerUser.

docker-compose.yml passes both through to the app container, and
.env.example gains a "Tenant / RBAC" section with the default
values and the same sentinel rules inline so the example is the
sole reference operators need.

No functional change — both env vars were already honoured by
config.go.applyAuthAndTenantDefaults.
This commit is contained in:
wizardchen
2026-05-18 20:58:27 +08:00
committed by lyingbug
parent 49f3ad185a
commit 633106c5ef
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -170,6 +170,12 @@ services:
# Agent LLM call timeout
- WEKNORA_AGENT_LLM_TIMEOUT=${WEKNORA_AGENT_LLM_TIMEOUT:-}
- WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT=${WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT:-}
# Tenant / RBAC(详见 docs/rbac.md 与 .env.example 注释)
# - WEKNORA_TENANT_ENABLE_RBAC: 是否启用租户角色强制鉴权(true / false),默认 false
# - WEKNORA_TENANT_MAX_OWNED_PER_USER: 单个非超管自助创建租户的上限
# >0 强制限额;=0 走 handler 默认;<0 关闭限额(不建议共享部署使用)
- WEKNORA_TENANT_ENABLE_RBAC=${WEKNORA_TENANT_ENABLE_RBAC:-}
- WEKNORA_TENANT_MAX_OWNED_PER_USER=${WEKNORA_TENANT_MAX_OWNED_PER_USER:-}
- APK_MIRROR_ARG=${APK_MIRROR_ARG:-}
depends_on:
redis: