Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

chore(auth): drop redundant WEKNORA_AUTH_REGISTRATION_MODE env override

wizardchen2ab54f15424c
diff --git a/docs/rbac.md b/docs/rbac.md
index 85d976a47..77c03b46e 100644
--- a/docs/rbac.md
+++ b/docs/rbac.md
@@ -130,9 +130,15 @@ Environment overrides (always win over YAML):
| Env var | YAML key | Values |
|--------------------------------------|--------------------------------|------------------------------|
| `WEKNORA_TENANT_ENABLE_RBAC` | `tenant.enable_rbac` | `true` / `false` |
-| `WEKNORA_AUTH_REGISTRATION_MODE` | `auth.registration_mode` | `self_serve` / `invite_only` |
| `WEKNORA_AUDIT_RETENTION_DAYS` | `audit.retention_days` | non-negative integer |
+`auth.registration_mode` is intentionally not env-overridable to avoid
+duplicating the long-standing `DISABLE_REGISTRATION` env knob. Set
+`auth.registration_mode: invite_only` in `config.yaml` when you want the
+frontend to hide the registration entry in addition to the server-side
+block; use `DISABLE_REGISTRATION=true` for a quick env-level kill switch
+that only enforces server-side.
+
The startup logger emits one line summarising both effective values
plus their override sources, so you can confirm at boot which mode
the deployment is in.
diff --git a/internal/config/config.go b/internal/config/config.go
index 07febc003..262d842f9 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -707,12 +707,18 @@ func applyAgentEnvOverrides(cfg *Config) {
// - tenant.enable_rbac -> false (rolled out in two steps; flip later)
//
// Env overrides (when set and non-empty):
-// - WEKNORA_AUTH_REGISTRATION_MODE ("self_serve" or "invite_only")
// - WEKNORA_TENANT_ENABLE_RBAC ("true"/"false", case-insensitive)
// - WEKNORA_TENANT_MAX_OWNED_PER_USER (integer; <0 disables the cap,
// 0 falls back to the handler default, >0 enforces that exact cap).
// Unparseable / empty values are ignored so a stale shell variable
// can't silently disable the quota for a future deployment.
+//
+// Note: auth.registration_mode is intentionally NOT env-overridable.
+// Operators who need to turn off public registration set the legacy
+// DISABLE_REGISTRATION=true env (handled at the /auth/register handler
+// layer) or flip auth.registration_mode in config.yaml; the env layer
+// keeps a single knob to avoid two redundant ways of saying the same
+// thing.
func applyAuthAndTenantDefaults(cfg *Config) {
if cfg.Auth == nil {
cfg.Auth = &AuthConfig{}
@@ -721,9 +727,6 @@ func applyAuthAndTenantDefaults(cfg *Config) {
cfg.Tenant = &TenantConfig{}
}
- if value := strings.TrimSpace(os.Getenv("WEKNORA_AUTH_REGISTRATION_MODE")); value != "" {
- cfg.Auth.RegistrationMode = value
- }
if strings.TrimSpace(cfg.Auth.RegistrationMode) == "" {
cfg.Auth.RegistrationMode = AuthRegistrationModeSelfServe
}