The environment variables the Wiki's server and web app read: what each does, its default, and where to set it
Environment variables are for what a server needs before it can read its settings (the encryption key, the database on first boot) and for per-server tuning. Everything else is a setting: stored encrypted in PostgreSQL, changed in Settings, and the same on every server at once (see Settings reference).
1. Where to set them
| Running the Wiki as | Set them in |
|---|
| A service (systemd) | An EnvironmentFile= readable only by the service user, for example /etc/wiki/server.env (mode 0600) |
| Containers you build | docker run -e NAME=value or --env-file; secrets from your orchestrator's secret store |
- A value the server can't read (a duration that isn't one, a number out of range) stops it at startup with a message naming the variable.
- Durations are written 30s, 15m, 24h. Sizes are bytes unless the name says otherwise. Schedules are cron expressions (minute hour day month weekday, UTC).
- Some defaults apply only until an administrator saves the matching settings page; the page then wins on every server.
In a cluster, give every server the same values, except the per-server ones (PORT, BIND_ADDR, NODE_DISPLAY_NAME, directories, LOG_LEVEL).
2. Bootstrap
| Variable | Default | Meaning |
|---|
| CONFIG_ENCRYPTION_KEY | none, required | Encrypts the bootstrap file and every credential stored in the database. Required on every start; the same on every server; keep it with your backups |
| DATABASE_URL | none | PostgreSQL URL. Needed on a server's first start (and for setup); then saved, encrypted, in the bootstrap file. Add pool_max_conns=N and sslmode=verify-full as needed |
| BOOTSTRAP_FILE_PATH | ./data/bootstrap.enc | Where the server keeps its encrypted bootstrap file. Per server; keep it on persistent disk |
| PORT | 8080 | The server's HTTP port |
| BIND_ADDR | 127.0.0.1 | Address the server listens on |
| FRONTEND_URL | http://localhost:3000 (set it: the web app listens on 3002) | Where the web app is; also the default allowed CORS origin. Set it to the Wiki's address |
| CORS_ALLOWED_ORIGINS | FRONTEND_URL | Comma-separated origins allowed to call the API from a browser |
| APP_ENV | empty | development prints the log as readable lines instead of JSON; leave it unset in production |
3. Setup and recovery
| Variable | Default | Meaning |
|---|
| SETUP_TOKEN | random, new on every start | The setup key the wizard needs. Set it to choose it |
| SETUP_CONFIG_FILE | empty | A setup file for unattended setup; same as --setup-config |
| SETUP_UPLOAD_DIR | ./data/setup-upload | Where a backup uploaded to the wizard's Restore from a backup waits |
| RECOVERY_TOKEN | random | The key of the recovery page |
| LICENSE_BANNER_DAYS | 30 | Super admins see a banner this many days before the licence expires (0 turns it off) |
4. Reverse proxy and web app
| Variable | Default | Meaning |
|---|
| TRUSTED_PROXIES | 127.0.0.0/8,::1/128 | Proxies whose forwarding headers the server trusts (IPs or CIDRs). List the web app and every proxy in front |
| FRONTEND_BEHIND_PROXY | false | Web app: true when a proxy in front sets X-Forwarded-For, -Host and -Proto. Then only the proxy may reach the web app's port |
| FRONTEND_API_BODY_LIMIT | 33554432 (32 MiB) | Web app: largest /api request it forwards. Uploads to a page have their own 201 MiB limit |
| BACKEND_URL | http://127.0.0.1:8080 | Web app: where the server is |
| CSP_ENFORCE | unset (enforced) | Web app: false sends the Content-Security-Policy report-only |
5. Sign-in and sessions
| Variable | Default | Meaning |
|---|
| AUTH_LOCKOUT_THRESHOLD, AUTH_LOCKOUT_WINDOW, AUTH_LOCKOUT_DURATION | 5, 15m, 15m | Wrong passwords that lock an account, how long they count, how long it stays locked |
| AUTH_IP_RATE_LIMIT, AUTH_IP_RATE_WINDOW | 20, 15m | Failed sign-ins and unknown tokens per address before it's blocked |
| AUTH_PASSWORD_MIN_LENGTH | 12 | Minimum password length (8–64) |
| AUTH_SESSION_LIFETIME, AUTH_REMEMBER_SESSION_LIFETIME | 24h, 168h | Longest session without and with Remember me (until saved in Settings → Security → Sessions) |
| AUTH_MAX_SESSIONS | 5 | Sessions per person |
| AUTH_COOKIE_DOMAIN, AUTH_COOKIE_SECURE | the host, true | Session cookies: their domain, and HTTPS only |
| AUTH_PASSWORD_RESET_TTL, AUTH_INVITATION_TTL | 30m, 168h | Lifetimes of password reset and invitation links |
| AUTH_LOGIN_HISTORY_RETENTION_DAYS | 90 | Days of sign-in history kept |
| SSO_ENFORCEMENT_OVERRIDE | false | Emergency only: true ignores Require single sign-on on this server so an administrator can sign in with a password while the identity provider is down |
6. Rate limits
Defaults until saved in Settings → Security → Rate limits (see Rate limits); 0 turns a limit off. The Wiki's own limits (Q&A posts, calendar reads and writes, page views reported by anonymous readers) are built in.
| Variable | Default | Meaning |
|---|
| RATE_LIMIT_PREAUTH | 10000 | Requests per minute per address before sign-in is checked |
| RATE_LIMIT | 600 | Per minute per person in the browser |
| RATE_LIMIT_ANON | 60 | Per minute per address for anonymous requests |
| RATE_LIMIT_WS | 20 | WebSocket connections per minute per address |
| RATE_LIMIT_SETUP | 30 | Per minute per address in setup and recovery mode |
| RATE_LIMIT_DRY_RUN | false | true logs requests over a limit instead of refusing them |
7. Database, Redis and cluster
| Variable | Default | Meaning |
|---|
| DB_CONNECT_TIMEOUT | 30s | How long a starting server keeps trying the database |
| DB_SLOW_QUERY_THRESHOLD | 500ms | Queries slower than this are logged as warnings |
| NODE_DISPLAY_NAME | empty | This server's name in Settings → Clustering |
| CLUSTER_HEARTBEAT_INTERVAL, CLUSTER_DEAD_THRESHOLD, CLUSTER_LEADER_GRACE | 10s, 3, 5 | Heartbeats, and missed ones before a server, or the leader, is replaced |
| CLUSTER_DEAD_NODE_TTL, CLUSTER_EVENT_RETENTION_DAYS | 24h, 7 | When servers that left drop off the list; days of cluster events kept |
| READ_CACHE_ENABLED | true | Per-server cache of roles and settings; false reads the database every time |
| READ_CACHE_CHECK_INTERVAL, READ_CACHE_MAX_AGE, READ_CACHE_MAX_ENTRIES | 1s, 5m, 20000 | How often it checks for changes, the longest it keeps an item, items per kind |
Redis, storage and the licence are not environment variables: they're entered in the setup wizard (or setup file), stored encrypted, and changed in Settings or on the recovery page.
8. Logging, audit and metrics
| Variable | Default | Meaning |
|---|
| LOG_LEVEL | info | debug, info, warn, error; change it live in Settings → Logging |
| LOG_REDACT_ENABLED | true | Remove secrets from log lines |
| LOG_FILE_ENABLED, LOG_FILE_DIR | true, ./data/logs | This server's log files |
| AUDIT_LOG_RETENTION_DAYS | 90 | Days of audit log kept |
| METRICS_ADDR | off | A separate listener serving /metrics without authentication: bind it to a private interface. See Monitoring |
| METRICS_TOKEN | off | Also serve /metrics on the main port to Authorization: Bearer <token> |
| SYSTEM_CHECK_INTERVAL | 1h | How often each server runs its system check |
9. Scheduler, events and plugins
| Variable | Default | Meaning |
|---|
| SCHEDULER_LOCK_TTL, SCHEDULER_SHUTDOWN_GRACE_PERIOD | 5m, 30s | How long a job's lock lasts without renewal; time running jobs get on shutdown |
| PAGINATION_CURSOR_SECRET | unset | Signs paging cursors so clients can't forge them. Recommended; the same on every server |
| EVENT_MAX_ATTEMPTS, EVENT_OUTBOX_RETENTION_DAYS | 8, 7 | Retries and retention of durable event deliveries |
| AUTOMATION_WEBHOOK_ALLOW_PRIVATE, AUTOMATION_WEBHOOK_ALLOW_HTTP | false | Allow webhooks to private addresses, or plain http |
| PLUGIN_SIGNING_REQUIRED | true | Refuse plugins not signed by a trusted key |
| PLUGIN_MAX_PACKAGE_SIZE | 20 MiB | Largest plugin package |
| PLUGIN_DATABASE_URL | the main database | Put plugin schemas on another PostgreSQL database |
Most scheduled jobs' times and retention are changed in Settings → Advanced → Scheduled jobs instead (see Scheduled jobs); backups in Settings → Backups (see Backups).