Skip to content
GitHub

Configuration

Configuration options for lexigram-admin.

Configuration is loaded through AdminConfig, passed to AdminModule.configure(). It can also be set via environment variables (recommended for production) or a YAML file.

from lexigram.admin.config import AdminConfig
config = AdminConfig(
prefix="/admin",
title="My App Admin",
features=AdminFeaturesConfig(audit_logging=True),
)
module = AdminModule.configure(config)
FieldTypeDefaultEnv varDescription
prefixstr/adminLEX_ADMIN__PREFIXURL prefix for all admin routes
titlestrLexigram AdminLEX_ADMIN__TITLEPanel title shown in browser and header
contributor_collision_modeLiteral["warn", "error"]"warn"LEX_ADMIN__CONTRIBUTOR_COLLISION_MODEHow to handle name collisions between contributors
features.audit_loggingboolTrueLEX_ADMIN__FEATURES__AUDIT_LOGGINGLog every write action with user and diff
features.enabledboolTrueLEX_ADMIN__FEATURES__ENABLEDMaster toggle for all admin features
auth.session_secretstrchange-me-in-productionLEX_ADMIN__AUTH__SESSION_SECRETSecret for signing session cookies (required in production)
auth.session_lifetimeint86400LEX_ADMIN__AUTH__SESSION_LIFETIMESession validity in seconds
auth.idle_timeoutint3600LEX_ADMIN__AUTH__IDLE_TIMEOUTIdle session expiry in seconds
resource_defaults.per_pageint20LEX_ADMIN__RESOURCE_DEFAULTS__PER_PAGEDefault rows per page
resource_defaults.default_sortstr | NoneNoneDefault sort field for all resources
ui.themestrsystemLEX_ADMIN__UI__THEMEUI colour scheme (light, dark, or system)
tenancy.enabledboolFalseLEX_ADMIN__TENANCY__ENABLEDEnable multi-tenant resource scoping
audit.read_audit_enabledboolFalseLEX_ADMIN__AUDIT__READ_AUDIT_ENABLEDLog GET requests for compliance (off by default)
audit.redaction_field_denylisttuple[str]("email", "phone", "password_hash", "ssn")LEX_ADMIN__AUDIT__REDACTION_FIELD_DENYLISTField names redacted from audit payloads
audit.redaction_patternstuple[str]("email", "phone")LEX_ADMIN__AUDIT__REDACTION_PATTERNSNamed patterns for value-level redaction
VariableDescription
LEX_ADMIN__ENABLEDMaster toggle (true/false)
LEX_ADMIN__PREFIXAdmin URL prefix
LEX_ADMIN__TITLEPanel title
LEX_ADMIN__CONTRIBUTOR_COLLISION_MODEwarn or error
LEX_ADMIN__AUTH__SESSION_SECRETSession signing secret
LEX_ADMIN__AUTH__SESSION_LIFETIMESession TTL in seconds
LEX_ADMIN__AUTH__IDLE_TIMEOUTIdle timeout in seconds
LEX_ADMIN__FEATURES__AUDIT_LOGGINGEnable/disable audit logging
LEX_ADMIN__RESOURCE_DEFAULTS__PER_PAGEDefault rows per page
LEX_ADMIN__UI__THEMElight, dark, or system
LEX_ADMIN__TENANCY__ENABLEDEnable tenancy
LEX_ADMIN__AUDIT__READ_AUDIT_ENABLEDEnable read-operation audit logging
LEX_ADMIN__AUDIT__REDACTION_FIELD_DENYLISTComma-separated field names to redact
LEX_ADMIN__AUDIT__REDACTION_PATTERNSComma-separated pattern names (email, phone)
  • Keep config minimal — use sensible defaults.
  • Use environment variables for secrets (never hardcode session_secret).
  • Set contributor_collision_mode to "error" in CI to catch naming conflicts.
  • Use AdminModule.stub() for test configurations instead of AdminModule.configure().