Environment variables
This page is for the people who run an Adiutor server. It lists every variable the app reads from its environment, grouped by what it’s for. To install Adiutor, start with Docker.
How the environment is read
Section titled “How the environment is read”- The server checks its environment when it starts. If a variable is missing or wrong, the app stops with “Invalid environment variables” and lists every problem at once, so you can fix them in one go.
- An empty value counts as unset.
GITHUB_CLIENT_ID=in a.envfile is the same as leaving the line out. - Some settings can also be made in Settings by a staff Admin: the mail server, where files are kept and the largest file. When the environment sets them, the environment wins, and Settings only shows what is in use. This keeps staff Admins from pointing the server at addresses of their own when you don’t want that. See Mail server and Attachments.
- In production (
NODE_ENV=production), the app refuses a few settings that are only fit for development. The tables say which. - Generate secrets with
openssl rand -base64 32, and keep them out of version control.
Required
Section titled “Required”Adiutor won’t start without these three.
| Variable | Default | What it does |
|---|---|---|
DATABASE_URL |
none | The PostgreSQL connection string for all of the app’s data. Example: postgresql://adiutor:[email protected]:5432/adiutor. |
BETTER_AUTH_SECRET |
none | The secret that signs sessions and encrypts sensitive data such as authenticator secrets, and from which the app works out some secrets of its own. At least 32 characters. Generate one with openssl rand -base64 32. To replace it later, see Rotating the secret. |
BETTER_AUTH_URL |
none | The public address of the app, as people type it. Used for links in emails and as the base of the sign-in providers’ callback addresses. Example: https://adiutor.dev. In production it must start with https:// (http:// only works for localhost), because cookies, passkeys and HSTS need HTTPS. Passkeys are tied to its host name, so moving Adiutor to another host later leaves people’s passkeys behind. |
Rotating the secret
Section titled “Rotating the secret”This is optional. Leave BETTER_AUTH_SECRETS out until you want to replace the secret, and keep BETTER_AUTH_SECRET set at all times.
| Variable | Default | What it does |
|---|---|---|
BETTER_AUTH_SECRETS |
none | Versioned secrets, to replace BETTER_AUTH_SECRET without losing encrypted data. Newest first, as version:secret pairs separated by commas. Example: 2:the-new-secret-at-least-32-chars-long,1:the-older-one. Optional. |
BETTER_AUTH_SECRET signs cookies and encrypts authenticator secrets, backup codes and the saved secrets of the mail server, file storage and webhooks. To replace it without losing any of that:
- Keep
BETTER_AUTH_SECRETas it is. SetBETTER_AUTH_SECRETSto1:<the new secret>. The first secret must be at least 32 characters, each version may appear once, and the newest comes first. - New data is encrypted with the new secret. Older data still decrypts with
BETTER_AUTH_SECRET. - The next time, put the newer secret in front:
2:<newer>,1:<new>. Drop an old version only when nothing encrypted with it is left.
Changing the current secret signs everyone out once. Pictures people see are fetched again once, and the app’s own derived keys change. After a suspected leak, see Secrets and incidents.
Server
Section titled “Server”| Variable | Default | What it does |
|---|---|---|
PORT |
3000 |
The port the server listens on. Not checked by Adiutor: next start reads it. The Docker image’s health check reads it too, so if you change PORT, change it for both. The image exposes port 3000. |
Sign-in providers
Section titled “Sign-in providers”People can also sign in with GitHub or Google once you set them up here. A provider is on when both of its values are set, and off when either is missing. Create the OAuth app at the provider, and give it this callback address: your BETTER_AUTH_URL, then /api/auth/callback/github or /api/auth/callback/google. For example, https://adiutor.dev/api/auth/callback/github.
| Variable | Default | What it does |
|---|---|---|
GITHUB_CLIENT_ID |
none | The GitHub OAuth app’s client ID. |
GITHUB_CLIENT_SECRET |
none | The GitHub OAuth app’s client secret. Only while both GitHub values are set does a person’s GitHub two-factor authentication count as a second step in Adiutor. |
GOOGLE_CLIENT_ID |
none | The Google OAuth client’s ID. |
GOOGLE_CLIENT_SECRET |
none | The Google OAuth client’s secret. Google sign-in never counts as a second step. |
Adiutor sends sign-in links, invitations, security notices and the emails about requests. Set the mail server here, or leave both values out and let a staff Admin set it up on the Integrations tab of Settings. Without either, every email fails (development prints them instead), and a production server logs a warning when it starts. See Email and Mail server.
| Variable | Default | What it does |
|---|---|---|
SMTP_URL |
none | The mail server, as a URL. It wins over the mail server saved in Settings, which then only shows it, without its password. Use TLS: smtps://user:[email protected]:465, or smtp://user:[email protected]:587?requireTLS=true for STARTTLS. In production the app refuses smtp:// without requireTLS=true, except to a server on the same computer, because the emails carry sign-in links. Up to 3 connections are kept open; add ?maxConnections=1 or ?pool=false if your provider needs it. |
EMAIL_FROM |
The sender saved in Settings, else Adiutor <[email protected]> |
The sender of outgoing email. When set, it wins over the sender saved in Settings. Use an address on a domain you control, such as Adiutor <[email protected]>; the built-in default is an address providers that check the sender reject. |
Client IP address
Section titled “Client IP address”Rate limits, the audit log, the list of signed-in devices and the security emails all use the visitor’s IP address. Tell Adiutor where to read it. See Reverse proxy before changing these, and check afterwards that your own address shows up under Signed-in devices.
| Variable | Default | What it does |
|---|---|---|
CLIENT_IP_HEADERS |
x-forwarded-for |
The request headers to read the address from, in order, separated by commas. Use x-real-ip behind a proxy that sets it, or cf-connecting-ip behind Cloudflare. The default is right on Vercel. |
TRUSTED_PROXIES |
none | The IP addresses or CIDR ranges of your reverse proxies, separated by commas, for example 10.0.0.5,10.0.1.0/24. With them, a chain of addresses is read from the right, skipping your proxies, so visitors can’t choose their own. Without them, only a header holding a single address counts. |
Background jobs
Section titled “Background jobs”Background work, such as sending queued emails and clearing out old data, runs as jobs that a tick starts every 5 minutes (every 15 with Vercel’s own schedule). A tick can be started in three ways. A server can run pnpm jobs:run from cron. A cron service can call the jobs’ address, which is what CRON_SECRET is for. And Vercel’s schedule calls the same address. See Background jobs.
| Variable | Default | What it does |
|---|---|---|
CRON_SECRET |
none | The secret the background jobs’ address (/api/jobs) asks for, sent as Authorization: Bearer <secret>. At least 32 characters. Vercel’s schedule sends it by itself. Optional, but without it that address is off and only a job runner on the server (pnpm jobs:run) starts the jobs. See Background jobs. |
VERCEL_AUTOMATION_BYPASS_SECRET |
none | Vercel’s Protection Bypass for Automation secret, which Vercel sets itself once you generate it. The jobs’ address sends it when it continues a tick on a protected Preview deployment. Leave it empty everywhere else. |
Attachments
Section titled “Attachments”Where the files people attach are kept. Set ATTACHMENTS_STORAGE here, or leave the whole group out and let a staff Admin choose on the Integrations tab of Settings. Without a storage, attachments are off. See File storage and Attachments.
When ATTACHMENTS_STORAGE is set, the environment wins, and Settings only shows the storage, without its secrets. off turns attachments off and keeps staff Admins from choosing a storage. A driver missing something it needs is reported by name when the app starts.
| Variable | Default | What it does |
|---|---|---|
ATTACHMENTS_STORAGE |
none | Where files are kept: local (a folder), s3 (a bucket of an S3-compatible service), sftp (a folder on another server) or off. local isn’t allowed on Vercel, whose disk doesn’t keep files. |
ATTACHMENTS_DIR |
none | For local: an absolute path to a folder that exists and that the app can write to. In Docker, mount a volume on /data/attachments and use ATTACHMENTS_DIR=/data/attachments. |
ATTACHMENTS_S3_ENDPOINT |
none | For s3: the service’s address, for example https://account-id.r2.cloudflarestorage.com. In production it must be https://, except for a server on the same computer. |
ATTACHMENTS_S3_REGION |
us-east-1 |
For s3: the region requests are signed for. Use auto on Cloudflare R2. |
ATTACHMENTS_S3_BUCKET |
none | For s3: the bucket’s name. 3 to 63 lowercase letters, digits, dots and dashes. |
ATTACHMENTS_S3_ACCESS_KEY_ID |
none | For s3: the access key’s ID. It only needs to read, write and delete objects in the bucket. |
ATTACHMENTS_S3_SECRET_ACCESS_KEY |
none | For s3: the access key’s secret. |
ATTACHMENTS_S3_FORCE_PATH_STYLE |
none | For s3: true to put the bucket in the path instead of the host name, as most servers of your own need. Unset means false: the bucket goes in the host name. |
ATTACHMENTS_SFTP_HOST |
none | For sftp: the server’s host name or address. |
ATTACHMENTS_SFTP_PORT |
22 |
For sftp: the SSH port, 1 to 65535. |
ATTACHMENTS_SFTP_USERNAME |
none | For sftp: the user to sign in as. |
ATTACHMENTS_SFTP_PASSWORD |
none | For sftp: the user’s password. Set this or ATTACHMENTS_SFTP_PRIVATE_KEY. |
ATTACHMENTS_SFTP_PRIVATE_KEY |
none | For sftp: the user’s private key (the PEM file) in base64, so it fits on one line. Make it with base64 < key. |
ATTACHMENTS_SFTP_HOST_KEY |
none | For sftp: the server’s host key fingerprint, as ssh-keygen -lf prints it: SHA256: and 43 characters. Adiutor connects only to a server with that key. Required. |
ATTACHMENTS_SFTP_DIR |
none | For sftp: the folder on the server, as an absolute path. |
ATTACHMENTS_MAX_FILE_MB |
10 |
The largest file anyone may attach, in megabytes: 1 to 50, and at most 4 on Vercel. When set, it wins over Settings. Unset, Settings decides, and starts at 10. |
Keep the files in step with the database when you back up. Behind a reverse proxy, let request bodies up to the file limit through to /api/attachments.
Webhooks
Section titled “Webhooks”| Variable | Default | What it does |
|---|---|---|
WEBHOOK_ALLOWED_NETWORKS |
none | Networks inside your own that webhooks may still send to, as IP addresses or CIDR ranges separated by commas, for example 10.20.0.0/16 for a receiver on your local network. Without it, webhooks never reach a private, loopback or link-local address. Allow as little as you can: anyone who can add a webhook can reach every address in it. Each range allows its own family only, so write an IPv4 network as IPv4 (10.20.0.0/16), not as an IPv4-mapped IPv6 range. Only the server’s environment sets this, never anyone in the app. |
See Webhooks for how staff Admins add them.
Set for you
Section titled “Set for you”You normally don’t set these. The platform or the image does.
| Variable | Default | What it does |
|---|---|---|
NODE_ENV |
none | development, production or test. Next.js sets it (next dev is development, next build and next start are production), and the Docker image sets production. In production the app applies the stricter rules described above: an https:// address, TLS for the mail server and an https:// S3 endpoint. Scripts run without it count as neither, so they never fall back to development behaviour such as printing emails. On a plain server, scripts run from cron, such as pnpm jobs:run, don’t get it from Next.js, so set NODE_ENV=production for them yourself, or the production rules (HTTPS, TLS) don’t apply to them. |
VERCEL |
none | 1 on Vercel, which sets it. It makes Adiutor refuse local file storage and cap the largest file at 4 MB, because Vercel’s disk doesn’t keep files and it limits request bodies. See Vercel. |
DATABASE_URL_UNPOOLED |
none | Read only by the build command in vercel.json, never by the running app: each build of main and production runs the migrations through it first, and uses DATABASE_URL when it isn’t set. Migrations should use a direct connection, not a pooled one. Neon’s Vercel integration sets it; with a separate Preview database, you set it for Preview yourself. See Vercel. |
VERCEL_AUTOMATION_BYPASS_SECRET, which Vercel also sets, is described under Background jobs.
Example
Section titled “Example”A .env for a production server behind HTTPS, with email, GitHub sign-in and files on an S3-compatible bucket. Fill in the two empty secrets and every other placeholder yourself.
# openssl rand -base64 32BETTER_AUTH_SECRET=BETTER_AUTH_URL=https://adiutor.dev# openssl rand -base64 32CRON_SECRET=
GITHUB_CLIENT_ID=your-client-idGITHUB_CLIENT_SECRET=your-client-secret
# Behind nginx, which sets X-Real-IPCLIENT_IP_HEADERS=x-real-ip
ATTACHMENTS_STORAGE=s3ATTACHMENTS_S3_ENDPOINT=https://account-id.r2.cloudflarestorage.comATTACHMENTS_S3_REGION=autoATTACHMENTS_S3_BUCKET=adiutor-filesATTACHMENTS_S3_ACCESS_KEY_ID=your-key-idATTACHMENTS_S3_SECRET_ACCESS_KEY=your-key-secretRelated
Section titled “Related”Adiutor's code is released under the MIT License. The Adiutor name and logo aren’t covered by it; see the notice.
Set in Inter and JetBrains Mono, under the SIL Open Font License (Inter, JetBrains Mono).