Skip to main content

Configuration & environment variables

This is the single reference for every ARCHENSTACK_RBAC_* variable the libraries read — which are required (the process fails loudly if unset), which are optional feature toggles, and what each one means. It complements Deployment modes (which mode reads which knob) and the per-library backend pages.

The posture: env is the single source of truth, and it fails loud​

Every library follows the same discipline for its deployment knobs:

  • No inline fallback for a required knob. A required var carries no code default. If it is unset (or blank / malformed), the library fails loudly — at boot, at config-load, or when the Spring context refuses to start — rather than silently substituting a literal. That crash is the discoverability mechanism.
  • One reader. Each library centralises env reads in a single config module (Django conf.py, Node config.ts, Go config_env.go, Rust WebConfig::from_env, Java ArchenstackRbacProperties). No other module reads the environment directly.
  • Optional toggles carry a documented default. An opt-in feature (the built-in claims resolver, the bootstrap bind) is the one place a default is legitimate — its "off" state is an explicit empty value, never inferred from a var's absence.
  • Ships in .env.example. Every required var is listed in the library's committed .env.example, so cp .env.example .env yields a bootable config.
The management feature is never configurable

The anti-lock-out check feature (rbac.manage) and its minimum level (FULL) are spec-pinned in the core and deliberately not exposed as a knob in any library. No environment variable can repoint them. See Security §2.1.

Python (pure core)​

archenstack-rbac is the framework-agnostic core — roles × features → level, canonical JSON, resolve/validate. It ships no web layer, no cache, and no database, so it reads no environment variables at all. You bring your own storage, cache, and HTTP layer, and any configuration (batch bounds, base path, tenancy) is entirely your host's concern.

This is intentional and consistent with the env-single-source posture: the core has no hidden env reads. The ARCHENSTACK_RBAC_* variables below belong to the adapters (Django, Node, Go, Rust, Java) that wrap a core.

Django (archenstack-rbac-django)​

The adapter reads each knob from the ARCHENSTACK_RBAC settings dict or, as a fallback, the matching ARCHENSTACK_RBAC_* environment variable — with no code default for the required ones. ARCHENSTACK_RBAC_DEFAULT_ORG is a top-level Django setting the host wires from the environment.

VariableRequired?Meaning
ARCHENSTACK_RBAC_DEFAULT_ORGRequiredThe dev / seed / migration-backfill org slug (e.g. root). No code fallback — an unset value raises. Never a request-time substitute for a missing org claim.
ARCHENSTACK_RBAC_CACHE_TTLRequiredCompiled-matrix cache TTL, seconds. 0 / empty ⇒ Django's "never expire" (rely on version-stamped invalidation). No code default.
ARCHENSTACK_RBAC_CHECK_BATCH_MAXRequiredMax items a single POST /check/ batch may carry (SPEC §15.1). No code default.
ARCHENSTACK_RBAC_AUDIT_DEFAULT_PAGE_SIZERequiredAudit-log page size when a request omits ?page_size= (SPEC §11). No code default.
ARCHENSTACK_RBAC_AUDIT_MAX_PAGE_SIZERequiredMaximum audit-log page size a single request may ask for. No code default.
ARCHENSTACK_RBAC_PLATFORM_SUBJECTSOptionalPlatform-admin allowlist — comma-separated stable sub strings granted cross-org authority. Empty ⇒ no platform-admin operator (fails closed).
ARCHENSTACK_RBAC_PLATFORM_SUBJECTS_EXPIRES_ATRequired once the allowlist is non-emptyISO-8601 instant after which the allowlist stops being honored. An armed allowlist with no expiry refuses to boot, so the grant cannot outlive the incident that justified it.
ARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_SUBJECTOptionalStable subject bound to the admin role in the default org at startup. Empty ⇒ no bootstrap (opt-in).
ARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_ROLEOptionalRole slug the bootstrap subject is bound to. Empty ⇒ the seeded administrator management-FULL holder.
JWT-claims resolver knobs are settings-dict, not env vars

Django's opt-in claims resolver is configured through the ARCHENSTACK_RBAC settings dict (JWT_SUBJECT_CLAIM, JWT_ORG_CLAIM, JWT_EMAIL_CLAIM, JWT_PLATFORM_CLAIM, JWT_PLATFORM_VALUE, JWT_CLAIMS_ATTR), not ARCHENSTACK_RBAC_* env vars. They name claims and where the validated claims mapping lives on the principal — structural, not operator-tuned. See Wiring multi-tenancy.

Node (@archenstack/rbac-node)​

loadAdapterConfig() (in src/adapter/config.ts) is the single reader. It throws a single error listing every missing/invalid required var, so whoever is deploying fixes them in one pass.

VariableRequired?Meaning
ARCHENSTACK_RBAC_DEFAULT_ORGRequiredThe tenant/org slug the single-org in-memory matrix serves. Blank/unset throws.
ARCHENSTACK_RBAC_CHECK_BATCH_MAXRequiredMax items per POST /check/ batch (positive integer). Blank/non-positive throws.
ARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_ROLERequiredThe role slug that MUST resolve rbac.manage FULL at startup (lock-out safety).
ARCHENSTACK_RBAC_JWT_RESOLVER_ENABLEDOptionalWire the built-in jwtClaimsRoleResolver. Default false (off).
ARCHENSTACK_RBAC_JWT_ROLE_CLAIMOptionalThe claim holding the caller's role slug (direct path). Default role.

Go (archenstack-rbac-go)​

adapter.ConfigFromEnv() (in adapter/config_env.go) is the single reader; the claims resolver is opt-in, and when it is off the server applies the fail-closed DenyAllResolver (never a header default).

VariableRequired?Meaning
ARCHENSTACK_RBAC_CHECK_BATCH_MAXRequiredMax items per POST /check/ batch (positive integer). Unset/blank/non-positive fails.
ARCHENSTACK_RBAC_CLAIMS_RESOLVER_ENABLEDOptionalWire the ClaimsRoleResolver. Default false (off ⇒ deny-all).
ARCHENSTACK_RBAC_ROLE_CLAIMOptionalRole claim name. Default role.
ARCHENSTACK_RBAC_ROLE_CLAIM_VALUEOptionalMembership-match value when the role claim is an array/scope string. Default empty.
ARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_SUBJECTOptionalSubject bound at startup. Empty ⇒ no bootstrap.
ARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_ROLEOptionalRole slug for the bootstrap subject. Default administrator.

Rust (archenstack_rbac, web feature)​

WebConfig::from_env() reads the one deployment knob; the claims resolver's role-claim is a struct field (ClaimsResolverConfig, default "role"), not an env read in the core. ARCHENSTACK_RBAC_BIND_ADDR belongs to the runnable serve example, not the library.

VariableRequired?Meaning
ARCHENSTACK_RBAC_CHECK_BATCH_MAXRequiredMax items per POST /check/ batch (SPEC §15.1). Unset / non-numeric / zero is a hard error at boot.
ARCHENSTACK_RBAC_BIND_ADDROptional (example)host:port the serve demo binds (e.g. 127.0.0.1:8080). Example-only, not read by the library.

Java / Spring (archenstack-rbac-spring-boot-starter)​

ArchenstackRbacProperties binds from the archenstack-rbac.* property namespace; Spring's relaxed binding lets the corresponding ARCHENSTACK_RBAC_* environment variable override each one. The required knobs are @NotBlank / @NotNull validated, so a missing one makes the context fail to start.

PropertyEnv varRequired?Meaning
archenstack-rbac.base-pathARCHENSTACK_RBAC_BASE_PATHRequiredURL prefix the management routes mount under (before /permissions/...), e.g. /api/v1.
archenstack-rbac.check-batch-maxARCHENSTACK_RBAC_CHECK_BATCH_MAXRequiredMax items per POST /check/ batch (SPEC §15.1).
archenstack-rbac.audit-default-page-sizeARCHENSTACK_RBAC_AUDIT_DEFAULT_PAGE_SIZERequiredAudit-log page size when a request omits ?page_size=.
archenstack-rbac.audit-max-page-sizeARCHENSTACK_RBAC_AUDIT_MAX_PAGE_SIZERequiredMaximum audit-log page size a single request may ask for.
archenstack-rbac.default-orgARCHENSTACK_RBAC_DEFAULT_ORGRequired when seedingDev / seed / backfill org slug. No inline default — unset with seeding on fails loudly. Never a request-time fallback.
archenstack-rbac.seed-on-startupARCHENSTACK_RBAC_SEED_ON_STARTUPOptionalSeed the sample catalogue on startup when the matrix is empty. Default true.
archenstack-rbac.member-jitARCHENSTACK_RBAC_MEMBER_JITOptionalJIT-register a valid (org, sub) as an assignable member on the resolve path. Default true.
archenstack-rbac.platform-subjectsARCHENSTACK_RBAC_PLATFORM_SUBJECTSOptionalPlatform-admin allowlist — a last-resort set of sub strings granted cross-org authority (comma-separated). Empty ⇒ no platform-admin operator (fails closed). Prefer a bounded IdP grant; see incident access.
archenstack-rbac.bootstrap-admin-subjectARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_SUBJECTOptionalSubject bound to the admin role in the default org at startup. Empty ⇒ no bootstrap.
archenstack-rbac.bootstrap-admin-roleARCHENSTACK_RBAC_BOOTSTRAP_ADMIN_ROLEOptionalRole slug the bootstrap subject binds to. Default administrator.
archenstack-rbac.scope-include-departmentARCHENSTACK_RBAC_SCOPE_INCLUDE_DEPARTMENTOptionalAdd the own_department scope atom to the served pack. Default false.
archenstack-rbac.scope-include-subtreeARCHENSTACK_RBAC_SCOPE_INCLUDE_SUBTREEOptionalAdd the transitive own_subtree chain-of-command atom to the served pack. Default false.
archenstack-rbac.scope-owner-fieldsARCHENSTACK_RBAC_SCOPE_OWNER_FIELDSOptionalObject FK field names tried in order for own_record. Default owner, created_by, user.
archenstack-rbac.scope-department-fieldARCHENSTACK_RBAC_SCOPE_DEPARTMENT_FIELDOptionalObject FK field name for own_department. Default department.
archenstack-rbac.enforcement-modeARCHENSTACK_RBAC_ENFORCEMENT_MODE (Django ENFORCEMENT_MODE)Optionalshadow makes the object authorizer and the coarse check (@Can / MatrixPermission) log a would-be denial and allow it through instead of blocking — for staging enforcement onto a live app (enforcement mode); rbac.manage is never shadowed. Default enforce.
archenstack-rbac.host-exception-adviceARCHENSTACK_RBAC_HOST_EXCEPTION_ADVICEOptionalRender a ScopeAuthorizer denial thrown from the host's own layer as a 403/401 instead of a 500. Default false.
archenstack-rbac.host-exception-advice-orderARCHENSTACK_RBAC_HOST_EXCEPTION_ADVICE_ORDEROptionalThe advice's @Order. Default HIGHEST_PRECEDENCE, so it wins over a host's generic @ExceptionHandler(Exception.class).
archenstack-rbac.tenant-contextARCHENSTACK_RBAC_TENANT_CONTEXTOptionalPublish the request's active org to ArchenstackTenantContext for the @PrePersist write-stamp (write-side only; does not scope reads). Default false.
archenstack-rbac.tenant-default-orgARCHENSTACK_RBAC_TENANT_DEFAULT_ORGOptionalFallback tenant for the @PrePersist stamp off a request (a seeder/cron). Empty ⇒ leave null and let NOT NULL/RLS reject it.

The JWT-claims resolver group (archenstack-rbac.jwt-resolver.*)​

Off by default; the built-in JwtClaimsRoleResolver reads identity claims off a Spring-Security-authenticated principal (Archenstack never validates the token). Overridable via ARCHENSTACK_RBAC_JWT_* env vars.

PropertyEnv varMeaning
archenstack-rbac.jwt-resolver.enabledARCHENSTACK_RBAC_JWT_RESOLVER_ENABLEDRegister the built-in resolver. Default false.
archenstack-rbac.jwt-resolver.subject-claimARCHENSTACK_RBAC_JWT_SUBJECT_CLAIMClaim holding the stable subject id (the assignment key). Default sub.
archenstack-rbac.jwt-resolver.org-claimARCHENSTACK_RBAC_JWT_ORG_CLAIMClaim holding the active org slug. Default org.
archenstack-rbac.jwt-resolver.email-claimARCHENSTACK_RBAC_JWT_EMAIL_CLAIMClaim holding the caller's email (member reconciliation). Default email.
archenstack-rbac.jwt-resolver.platform-claimARCHENSTACK_RBAC_JWT_PLATFORM_CLAIMClaim asserting platform-admin authority. Empty ⇒ none consulted.
archenstack-rbac.jwt-resolver.platform-valueARCHENSTACK_RBAC_JWT_PLATFORM_VALUEValue to match when the platform claim is an array / scope string. Empty ⇒ treat it as a plain boolean.
archenstack-rbac.jwt-resolver.platform-orgs-claimARCHENSTACK_RBAC_JWT_PLATFORM_ORGS_CLAIMClaim bounding the platform grant to a set of org slugs (array or space-delimited) — a parent governing only its subsidiaries. Empty ⇒ the grant stays unbounded. See Hierarchical organizations.

See also​