Skip to content

Environment Variables

CompassDocs is configured entirely through environment variables (via a .env file locally, or your platform’s environment settings). Only DATABASE_URL is required.

Variable Required Default Description
DATABASE_URL ✅ — PostgreSQL connection string, e.g. postgres://user:pass@host:5432/compassdocs.
DATABASE_SSL auto require forces TLS; disable turns it off. When unset, SSL is enabled for non-local hosts and off for localhost/127.0.0.1.
DATABASE_POOL_MAX 5 Maximum connections in the pool. Keep modest on serverless.
DATABASE_LISTEN_URL DATABASE_URL (1.20.19) The connection the helpdesk listens on for live queue updates. Set it to a direct or session-mode connection when DATABASE_URL goes through a transaction-mode pooler such as pgbouncer; otherwise the desk refreshes every 30 seconds. See Live desk updates.
DATABASE_POOL_WAIT_MS 30000 How long, in milliseconds, a request waits for a free connection before it fails (1.19.0). Before 1.19.0 it waited forever, so one stuck connection could stall every request.

Optional. Without them, the first visit to a fresh install opens the setup wizard, which creates the admin account in the browser (see First-run setup). With COMPASSDOCS_ADMIN_PASSWORD set, the admin is created on first launch instead, only while the users table is empty, and the wizard is skipped.

Variable Default Description
COMPASSDOCS_ADMIN_USER admin Username for the bootstrap admin (used only when COMPASSDOCS_ADMIN_PASSWORD is set). Its email is set to <username>@compassdocs.local; change it under your profile.
COMPASSDOCS_ADMIN_PASSWORD — Password for the bootstrap admin. When set, the account is created ready to use, with no forced password change. When unset, no account is created and the setup wizard runs.
COMPASSDOCS_SETUP_TOKEN worked out from the master key (1.20.27) The token the setup wizard asks for. Leave it unset: the app works one out from the master key and prints it in the server log until setup is done (docker compose logs app | grep -i 'setup token'). Set it to choose the token yourself, for an automated install. Useless once the first account exists. See First-run setup.
Variable Default Description
COMPASSDOCS_TRUSTED_PROXY_HOPS 1 How many trusted proxies sit in front of the app (the bundled Caddy counts as one). The sign-in throttle, the sign-in page’s lookup limit and the audit log read the client’s address from X-Forwarded-For that many entries from the right, so a client can’t dodge the limits by sending its own header. Set it to 2 when another proxy (Cloudflare, a load balancer) sits in front of Caddy. From 1.20.27 a value that isn’t an IP address is ignored.
COMPASSDOCS_BIND 0.0.0.0 (1.20.27) Read by the compose files, not the app: the host address port 3000 is published on by the plain docker-compose.yml. Leave it unset when people open CompassDocs on that port directly. Set 127.0.0.1 when your own reverse proxy on the same host forwards to it, so nobody can bypass the proxy and send their own X-Forwarded-For. The HTTPS stack never publishes port 3000. See Keep port 3000 private.
COMPASSDOCS_PASSWORD_HASH_CONCURRENCY 2 (1.20.27) How many password checks are worked out at once, from 1 to 4. Each uses about 128 MB of memory for a moment. When 32 more are waiting, a sign-in answers 503 with Retry-After: 5 instead of queueing. Raise it only on a server with memory and cores to spare.
COMPASSDOCS_SSO_ONLY_DISABLED unset (1.20.27, Enterprise) The emergency switch for SSO only. Set it to 1 and restart when single sign-on is broken and no break-glass account can sign in: every account with a password can then sign in with it again, whatever is saved, and every Settings page says so. Remove it and restart to enforce SSO only again.

The limits are counted per app process: with several instances behind a load balancer, each counts its own share. See Security.

Variable Default Description
COMPASSDOCS_BASE_URL unset (1.20.27) The workspace’s address, such as https://docs.example.com or http://intranet:3000, used for every link in mail when no custom domain is set under Settings → Domain & HTTPS (a custom domain wins). Without either, mail links are relative and the customer portal sends no sign-in links. Only an http or https address is used. See The workspace address.
Variable Default Description
ANTHROPIC_API_KEY unset Enables synthesized, cited answers on the Ask CompassDocs page. Without it, search falls back to keyword snippets. A key saved in Settings → AI takes precedence. From 1.20.0 it also serves Claude in the desk once an admin turns that on.
COMPASSDOCS_AI_MODEL claude-opus-5-5 (before 1.20.0, claude-opus-4-8) The model used when none is saved in Settings → AI. A model saved there wins. Any model ID is accepted; see Choosing a model.
COMPASSDOCS_ANTHROPIC_BASE_URL unset Testing only, not a supported setting. (1.20.0) Sends every Anthropic API call to another address, such as the fake Messages API the test suite starts. Never set it in production.

See AI-powered search for how the pipeline works. Claude in the desk adds no environment variable of its own: its settings are in Desk settings → Claude in the desk.

Variable Default Description
PORT 3000 Port the app listens on (used by the Docker compose file).
COMPASSDOCS_BACKUP_DIR /backups Where backups are written (mount a volume here). From 1.20.27 each backup is a set of the database and the attachments.
COMPASSDOCS_UPLOAD_DIR /uploads Where document attachments are stored (mount a volume here). From 1.20.27 its contents, except the master key file, are in every backup.
COMPASSDOCS_SECRET_KEY — Master key for encryption at rest (32 bytes: 64 hex or 44 base64 chars, e.g. openssl rand -hex 32). If unset, a key file is auto-generated in the uploads volume. Back it up outside your backup bucket.
COMPASSDOCS_KEY_FILE $COMPASSDOCS_UPLOAD_DIR/.secret.key Where the auto-generated master key file lives when COMPASSDOCS_SECRET_KEY isn’t set.
COMPASSDOCS_PLANTUML_SERVER https://www.plantuml.com/plantuml PlantUML server used to render ```plantuml blocks. Point at a self-hosted plantuml/plantuml-server to keep diagram text in-network, or set to off to disable.
COMPASSDOCS_EMBEDDINGS_URL provider default Override the semantic-search embeddings endpoint (e.g. an internal gateway). Takes precedence over the URL saved in Settings → AI.
COMPASSDOCS_FETCH_ALLOW_PRIVATE unset Set to 1 to let the server call addresses on private networks (10.x, 172.16.x to 172.31.x, 192.168.x, CGNAT and IPv6 ULA), such as webhooks to internal tools, a Snipe-IT server or (1.19.4) a helpdesk webhook receiver on your network. Unset, they are refused. Loopback, link-local and cloud metadata addresses are refused either way. See SSRF protection.

See Monitoring & health for the endpoints these configure.

Variable Default Description
COMPASSDOCS_METRICS_TOKEN — Bearer token a Prometheus scraper presents to GET /metrics. Unset, the endpoint is admin-session-only.
COMPASSDOCS_LOG_FORMAT console lines Set to json for JSON-lines operational logs (for Loki, CloudWatch, etc.). From 1.20.27 that includes a copy of every audit log entry.
COMPASSDOCS_AUDIT_STDOUT on (1.20.27) Set to 0 to stop writing each audit log entry to the server log as well. See The audit log in your server log.

Used by docker-compose.tls.yml to serve the app behind Caddy with HTTPS.

Variable Default Description
COMPASSDOCS_DOMAIN — Your domain, e.g. docs.example.com. Caddy serves it with automatic HTTPS.
COMPASSDOCS_FALLBACK_HOSTS unset (1.20.29) Comma-separated DNS names the bundled proxy keeps serving after a custom domain is applied, each as its own site served like the domain (HTTPS, with plain HTTP redirecting to it; HTTP only when the domain uses Plain HTTP), so you can always get back in if the domain stops working. The Azure template sets the VM’s <label>.<region>.cloudapp.azure.com. Not an IP address, not localhost; an invalid entry is skipped with a warning in the log. Links in email never use these. See Fallback addresses.

Optional: mirror backups to object storage. From 1.20.27 the app never deletes anything there: retire old copies with the bucket’s own lifecycle rules.

Variable Description
BACKUP_S3_BUCKET / BACKUP_S3_REGION / BACKUP_S3_ACCESS_KEY_ID / BACKUP_S3_SECRET_ACCESS_KEY S3-compatible target (AWS S3, Cloudflare R2, MinIO).
BACKUP_S3_ENDPOINT Set for R2/MinIO (custom endpoint). Optional for AWS.
BACKUP_S3_PREFIX Optional key prefix.
BACKUP_AZURE_CONNECTION_STRING / BACKUP_AZURE_CONTAINER Azure Blob Storage target.

Optional, for the helpdesk (Enterprise, 1.19.0).

Variable Default Description
COMPASSDOCS_PUSH_SUBJECT the custom domain, then the site’s https:// address, then the SMTP sender The contact the browsers’ push services see for your server, an https: URL or a mailto: address. Recommended: Safari refuses push without a valid one.
COMPASSDOCS_PUSH_HOSTS — More push service hosts to allow, comma-separated, for a browser whose push service is not one of the built-in ones below.
COMPASSDOCS_HD_ATTACHMENT_MAX_MB 25 The largest file, in MB, an agent or requester can attach to a ticket. Attachments are kept in the uploads volume.

Push notifications are sent from your server to each browser’s push service, over HTTPS (port 443). If your server’s outbound traffic is restricted, allow:

Host For
fcm.googleapis.com (and the older android.googleapis.com) Chrome, Edge on Android, Brave, Opera, Samsung Internet
updates.push.services.mozilla.com (any *.push.services.mozilla.com) Firefox
web.push.apple.com (any *.push.apple.com) Safari on macOS, iPhone and iPad
*.notify.windows.com Edge on Windows

Push goes through HTTPS_PROXY when it is set (and honors NO_PROXY). The server only ever sends to these hosts and any in COMPASSDOCS_PUSH_HOSTS: a subscription to any other host is refused.

Push needs the site on HTTPS (localhost is the one exception). The push keys are generated on first use and stored encrypted under the master key: changing COMPASSDOCS_SECRET_KEY without migrating the data means every agent turns push on again.

The helpdesk’s email channel and integrations receive requests from outside: /api/helpdesk/inbound/<secret> from your mail provider and /api/helpdesk/intake/<id> from monitoring tools. If CompassDocs is behind a firewall or a reverse proxy that limits paths, let those reach it over HTTPS.

Workspace settings live in the app, not the environment

Section titled “Workspace settings live in the app, not the environment”

Company name & logo, the sign-in page’s artwork and text, timezone, date/time format, theme, session timeout, trash retention, backup schedule, and the attachment size limit are configured from Settings (in the app) and stored in the database — not as environment variables. See Appearance & workspace.