Skip to main content

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

VariableDescription
CODEMAGIC_PATCH_API_DOMAINAPI/dashboard domain (no scheme/path)
CODEMAGIC_PATCH_STORAGE_DOMAINStorage domain (must differ from the API domain)
ACME_EMAILEmail for Let's Encrypt certificates
SERVER_URLPublic API URL, e.g. https://updates.example.com
PUBLIC_BASE_URLPublic artifact base, default https://<storage-domain>/codemagic-patch
POSTGRES_DB / _USER / _PASSWORDPostgreSQL credentials
MINIO_ROOT_USER / _PASSWORDMinIO credentials
WORKER_SHARED_SECRETProtects worker routes (>= 32 chars)
GITHUB_OAUTH_CLIENT_ID / _SECRETGitHub OAuth App credentials. At least one OAuth provider is required — GitHub and/or Bitbucket (BITBUCKET_OAUTH_CLIENT_ID / _SECRET)
OAUTH_CLI_AUTH_SECRETLocal random secret (>= 32 chars); signs CLI browser-login authorization codes. The legacy name OAUTH_DEVICE_POLL_TOKEN_SECRET is still accepted
INITIAL_ADMIN_EMAILSAllowlist 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

VariableDefaultDescription
MODEallall · api · worker. Self-host Compose hardcodes MODE=all; changing .env.selfhost alone does not split API/worker
REGISTRATION_MODEinvite_onlyinvite_only or open
STORAGE_ADAPTERs3 (self-host)s3 · gcs · memory, see Infrastructure adapters
DELIVERY_ADAPTERbase-urlbase-url or cloudflare (+ CLOUDFLARE_*), see Cloudflare setup and Infrastructure adapters
MANIFEST_CACHE_CONTROLno-cache, must-revalidateCache-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_SIZE200mbMax artifact upload size. Self-host Compose does not pass this through; customize docker-compose.selfhost.yml to override
RUN_MIGRATIONStrueRun DB migrations on boot
LOGGERtrueSet false to silence server logs