Black Branch/Docs
All sections

The install's settings file

This page is a reference for an owner who wants to understand the install's settings file. After it, you will know every value in /opt/blackbranch/.env, what it is for, and whether it can change.

Everything that makes your install yours, and every secret it was born with, lives in this one file. The installer writes it once and never rewrites it. You do not type any of these values: the installer fills them from your two answers and makes every secret at random. You can read them any time with sudo cat /opt/blackbranch/.env. You will meet them when you change a display value, read a Doctor row, or restore a backup.

Why one file, and why it matters so much

The file is the install's root of trust. The databases are protected by passwords in it, the platform sign-ins your viewers link are encrypted with a key in it, the credentials you save in the Admin Panel are encrypted with another key in it, and the backups are locked with the passphrase in it. None of those secrets exist anywhere else. Lose the file without a backup and the data it protects cannot be read again.

To read one value without opening the file: sudo grep '^SITE_NAME=' /opt/blackbranch/.env.

The install and its front door

Value What it is Changes?
COMPOSE_PROJECT_NAME The name Docker gives the install's containers and volumes (blackbranch) No
COMPOSE_FILE Which service lists Docker reads: compose.yaml alone in tunnel mode; plus compose.public.yaml (ports 80 and 443) in direct mode No
COMPOSE_PROFILES tunnel starts cloudflared; empty in direct mode No
BB_HOME Where the install lives, /opt/blackbranch No
BB_DOMAIN Your domain, from the first question Never
BB_TLS_MODE The front door: tunnel or direct (or internal, lab only) No
BB_ACME_EMAIL Direct mode: the address Let's Encrypt may write to about your certificates By hand
CLOUDFLARE_TUNNEL_TOKEN A dashboard tunnel's token, when you installed with --tunnel-token; empty otherwise By hand
BB_SUBNET, BB_CLOUDFLARED_IP, BB_CADDY_IP The install's private network inside the server, and the fixed addresses of cloudflared and the router on it. The router trusts a visitor's address only from cloudflared's address, and the chat service only from the router's. Only together, and only if they clash with a network the server already has

Updates

Value What it is Changes?
BB_RELEASE The release this server runs. Its own images carry it as their tag. By the updater only
BB_RELEASE_KEY The one key this server trusts to sign releases, recorded at install Never: an update never changes it
BB_UPDATE_FEED The folder releases are announced in (default https://blackbranch.app/releases); the server reads <channel>.json there By hand
BB_UPDATE_CHANNEL stable or beta. The one-line install sets beta, where every release so far is published. sudo blackbranch update --channel beta
BB_ENV_VERSION How many of the releases' own changes to this file have been applied. A release that renames or adds a value carries a numbered script that edits .env, like a database migration. By the updater only

Identity: permanent

These are made from the domain and can never change: the homeserver's name is written into every account, room and message, and the sign-in service knows the site by these addresses.

Value Example
SITE_ORIGIN https://example.com
SITE_API_ORIGIN https://api.example.com
SITE_API_WS_ORIGIN wss://api.example.com (live chat's connection)
MATRIX_SERVER_NAME example.com: the part after the colon in every Matrix ID
MATRIX_HOMESERVER_URL https://matrix.example.com
MATRIX_OAUTH_ISSUER https://matrix.example.com/auth/: the sign-in service's address
MATRIX_OAUTH_CLIENT_ID The site's own id at the sign-in service, made at random

Display values

The site reads these each time it starts. The setup pages fill most of them. The Admin Panel shows them but cannot change them: you change one on the server with sudo blackbranch set, for example sudo blackbranch set SITE_TAGLINE "Chat, together". It restarts what reads the value and puts the old one back by itself if the site does not come back healthy. A value may be up to 300 characters and may not contain $, ", \ or a line break.

Value Where it shows
SITE_NAME The site's name everywhere. Required.
SITE_SHORT_NAME The name under the icon when the site is installed as an app
SITE_TAGLINE The line shown when a link to the site is shared
SITE_DESCRIPTION The site's description for search engines and link previews
SITE_HOME_HEADING, SITE_HOME_INTRO The heading and line a signed-out visitor sees at the top of Home. No setup page asks for them.
SITE_ICON_SET /site-files when your own icons are in /opt/blackbranch/site-files/. The setup pages' icon upload sets it for you.
LEGAL_OPERATOR, LEGAL_CONTACT_EMAIL, LEGAL_GOVERNING_LAW, LEGAL_EFFECTIVE_DATE Who runs the site, as the Terms, Privacy and About pages name it
CURRENCY_NAME, CURRENCY_NAME_PLURAL, CURRENCY_SYMBOL, CURRENCY_ICON What your points are called and their icon
COMMUNITY_SCORE_NAME The name of the score on the leaderboard
YOUTUBE_VOD_PLAYLIST A YouTube playlist for past streams, or none

How to change each one, with examples: Site name, theme and looks.

Secrets

Each is random, made by the installer from the system's random number generator, and checked before the file is written: if one could not be made, the installer stops rather than write an empty secret.

Value What it protects
POSTGRES_PASSWORD The database server's administrator account. Used to build the database the first time, by migrations that need it, and by backups.
STREAM_DB_PASSWORD The site's own database account, used by the site, the chat service and the ingest service
SYNAPSE_DB_PASSWORD, MAS_DB_PASSWORD The homeserver's and its sign-in service's database accounts
STREAM_API_SECRET The shared secret the site presents when it calls the chat service, and that lets the blackbranch command ask the site for the Doctor's facts
AUTH_SECRET Signs the short-lived cookies the site's sign-in uses
TOKEN_ENC_KEY Encrypts the platform sign-ins (Twitch, Kick and so on) that viewers link to their accounts
INSTANCE_MASTER_KEY Encrypts every key and secret you save in the Admin Panel or on the setup pages (Stripe, PayPal, AI providers, backup bucket keys). Only the chat service holds it.
MATRIX_OAUTH_CLIENT_SECRET The site's password at the sign-in service
MAS_SYNAPSE_SECRET The secret the homeserver and its sign-in service share
MAS_ENCRYPTION_SECRET Encrypts sensitive data the sign-in service keeps in its database
SYNAPSE_REGISTRATION_SECRET, SYNAPSE_MACAROON_SECRET, SYNAPSE_FORM_SECRET Synapse's own internal secrets
BACKUP_PASSPHRASE Locks every backup. Shown once on the setup pages' recovery sheet.

⚠ Changing one of these breaks what it protects. You can open and edit the file, but the data each secret protects was locked with that exact value: a new TOKEN_ENC_KEY makes every linked platform sign-in unreadable, a new INSTANCE_MASTER_KEY every saved credential, a new BACKUP_PASSPHRASE every existing backup. There is no command to rotate them in this release. If you think one leaked, do not replace it: write to security@blackbranch.app (see Security for owners).

The Doctor checks that every one of these is present and not a placeholder, and that the stored tokens and credentials still decrypt with the keys in the file (see Health and the Doctor).

First boot

Value What it is
SETUP_TOKEN_HASH The fingerprint (sha256) of the setup link's token. The token itself is kept only in /opt/blackbranch/state/setup-token, readable by root; the site holds only this fingerprint, so it can check a link without being able to make one.
MATRIX_READER_TOKEN The sign-in of the read-only reader account the Forums tab and the Active threads widget use to read #forum. sudo blackbranch up makes the account and fills this in, at install and at every start.

The backup passphrase is deliberately not given to the site. The site decides where backups go, so a site that also held the key to open them could, if it were ever taken over, send the backups to its own server and read every secret in them. Instead the server hands the passphrase to the setup pages once, while the recovery sheet is on screen, and takes it back as soon as setup moves on.

Alerts from the server

Value What it is Changes?
BB_ALERT_NTFY_URL An ntfy topic address the server sends its own alerts to (a failed backup or restore check, an update that went back, low disk, a certificate near its end). Empty on a new install: then they go to the site's alerts topic (Admin Panel → Site → Site, card Alerts to your phone). By hand
BB_ALERT_EMAIL_COMMAND A command on the server that sends those alerts as an email, such as 'sendmail you@example.com'. Empty on a new install. By hand

With neither set, the alerts go to the server's log. Set one or both, then run sudo blackbranch alerts test. Details: Alerts from the server.

Next: The homeserver

← Install