Skip to content

Environment Variables

import { Aside } from ‘@astrojs/starlight/components’;

All configuration is passed to Kotauth via environment variables. Variables marked Required cause a fatal startup error if missing. Variables marked Recommended degrade functionality if absent but do not block startup.


Required.

The public base URL of the Kotauth instance. Used as the OIDC issuer (iss claim), in OIDC discovery documents, OAuth2 redirect URI validation, and email links.

KAUTH_BASE_URL=https://auth.yourdomain.com

Rules:

  • Must start with https:// when KAUTH_ENV=production. The server refuses to start otherwise.
  • HTTP is allowed for localhost in development mode.
  • No trailing slash.

Optional. Default: development

Controls startup validation strictness.

ValueBehavior
developmentHTTP allowed, default secrets tolerated, startup warnings printed
productionHTTPS required, default JWT secret rejected, strict cookie flags enforced
KAUTH_ENV=production

Recommended.

A 32+ character hex string used for AES-256-GCM encryption of SMTP passwords stored in the database and HMAC-SHA256 signing of short-lived cookies (MFA pending, PKCE verifier, portal session).

KAUTH_SECRET_KEY=a2c35a1bfe82492eb087c5a29b28fc2b1fc2505da2a6f5dd37201c2bf4df39b3

Generate one with:

Terminal window
openssl rand -hex 32

Required.

PostgreSQL JDBC connection URL.

DB_URL=jdbc:postgresql://db:5432/kotauth_db

Kotauth runs Flyway migrations on startup. The database and schema are created automatically — only the server, database name, and credentials need to exist beforehand.


Required.

DB_USER=postgres

Required.

DB_PASSWORD=changeme

These are not environment variables — they are configured per workspace through the admin console. Documented here for reference.

SettingDefaultNotes
Access token TTL300s (5 min)Configurable per application
Refresh token TTL86400s (24h)Workspace-wide
Email verification token24hFixed
Password reset token1hFixed
  • Minimum length (default: 8)
  • Require uppercase / lowercase / numbers / symbols
  • Maximum age in days (0 = no expiry)
  • Password history depth (0 = no history check)
ValueBehavior
optionalUsers can enroll but are not required to
requiredAll users must complete MFA before accessing the portal
required_for_adminsOnly users with the admin role are required to enroll
  • Host, port, username, password (AES-256-GCM encrypted at rest)
  • From address and display name
  • TLS mode: NONE, STARTTLS, or SSL

KAUTH_BASE_URL=http://localhost:8080
KAUTH_SECRET_KEY=a2c35a1bfe82492eb087c5a29b28fc2b1fc2505da2a6f5dd37201c2bf4df39b3
# DB is injected by docker-compose — no need to set here
KAUTH_BASE_URL=https://auth.yourdomain.com
KAUTH_ENV=production
KAUTH_SECRET_KEY=<openssl rand -hex 32>
DB_URL=jdbc:postgresql://your-db-host:5432/kotauth_db
DB_USER=kotauth
DB_PASSWORD=<strong password>