Configuration reference
Configuration reference
.env.selfhost is generated by scripts/selfhost/install.sh. See .env.selfhost.example for the fully annotated list. Edit it by hand only if you're not using the installer, then restart the stack with the same --project-name.
Required
| Variable | Description |
|---|---|
CODEMAGIC_PATCH_API_DOMAIN | API/dashboard domain (no scheme/path) |
CODEMAGIC_PATCH_STORAGE_DOMAIN | Storage domain (must differ from the API domain) |
ACME_EMAIL | Email for Let's Encrypt certificates |
SERVER_URL | Public API URL, e.g. https://updates.example.com |
PUBLIC_BASE_URL | Public artifact base, default https://<storage-domain>/codemagic-patch |
POSTGRES_DB / _USER / _PASSWORD | PostgreSQL credentials |
MINIO_ROOT_USER / _PASSWORD | MinIO credentials |
WORKER_SHARED_SECRET | Protects worker routes (>= 32 chars) |
GITHUB_OAUTH_CLIENT_ID / _SECRET | GitHub OAuth App credentials. At least one OAuth provider is required — GitHub and/or Bitbucket (BITBUCKET_OAUTH_CLIENT_ID / _SECRET) |
OAUTH_CLI_AUTH_SECRET | Local random secret (>= 32 chars); signs CLI browser-login authorization codes. The legacy name OAUTH_DEVICE_POLL_TOKEN_SECRET is still accepted |
INITIAL_ADMIN_EMAILS | Allowlist for the first invite-only admin sign-in |
info
The server refuses to boot while WORKER_SHARED_SECRET or OAUTH_CLI_AUTH_SECRET are shorter than 32 chars, or if an OAuth provider's client ID is set without its secret, so a verbatim copy of the example file fails fast instead of running with known secrets.
Common optional
| Variable | Default | Description |
|---|---|---|
MODE | all | all · api · worker. Self-host Compose hardcodes MODE=all; changing .env.selfhost alone does not split API/worker |
REGISTRATION_MODE | invite_only | invite_only or open |
STORAGE_ADAPTER | s3 (self-host) | s3 · gcs · memory, see Infrastructure adapters |
DELIVERY_ADAPTER | base-url | base-url or cloudflare (+ CLOUDFLARE_*), see Cloudflare setup and Infrastructure adapters |
MANIFEST_CACHE_CONTROL | no-cache, must-revalidate | Cache-Control header for meta.json and manifest JSON (client revalidation). With Cloudflare CDN, leave the default and use Cache Rules for edge TTL; see Cloudflare setup |
MAX_UPLOAD_SIZE | 200mb | Max artifact upload size. Self-host Compose does not pass this through; customize docker-compose.selfhost.yml to override |
RUN_MIGRATIONS | true | Run DB migrations on boot |
LOGGER | true | Set false to silence server logs |