Settings and modules
This page is for owners who wonder why a setting "will not change" or why a switch asks for a restart. After reading it you know the three places settings live, how a change reaches the running programs, and what a module switch does.
Using the Admin Panel is covered in The admin panel and Turning features on and off.
Three layers
| Layer | Where it is kept | What goes there | Who changes it | When a change applies |
|---|---|---|---|---|
| Install values | /opt/blackbranch/.env on the server |
What the site must know and trust before anything else: its name and addresses, the homeserver's name and sign-in client, the legal details, the points words, and every secret made at install | The installer, the setup pages, and sudo blackbranch set |
When the program that reads it starts again (sudo blackbranch set restarts the site for you) |
| Instance settings | The database | Everything you can change in the Admin Panel: platform channels, payment keys, AI connections, points rules, module switches, the backup target | The Admin Panel and the setup pages | Most at once. A few apply at the next restart of the program that reads them, and the panel marks those |
| Viewer settings | Each viewer's browser, plus a saved copy on the server | One viewer's own choices: chat look, font sizes, sounds, behaviour | The viewer, in the site's settings menu | At once, for that viewer only |
Why install values are not in the Admin Panel
Install values are the ones the site has to trust before it can trust anything else: which domain it is, which homeserver its accounts belong to, and the secrets that protect everything stored. If a web page could change them, anyone who got into an admin account could point the site's sign-in at their own server. So only someone with access to the server itself can change them. The site reads them when it starts and refuses to start if a required one is missing.
Nothing about an install is built into the website's image, so one image serves every install, and a changed name applies as soon as the site restarts. Which install values exist, and which you can change, is in Install values.
How one setting is resolved
Every setting is declared once in the product, with its kind, its default, which programs read it, and whether a change applies at once or at a restart. Each program reads a setting in this order:
- The program's environment, if the setting is set there. On a standard install a program only sees the values
compose.yamlgives it, which are mostly install values, so most settings come from the next step. - Otherwise the database, which is what the Admin Panel writes.
- Otherwise the product's default, which is always neutral: empty, off, or a plain number. No default names anyone's channel, person or price.
The Admin Panel shows, for each setting, where the value in use came from. A value set in the environment wins over the panel, so a setting that "will not change" in the panel is usually one set there.
Credentials
A key or password you paste into the Admin Panel is encrypted (AES-256-GCM) before it is stored, with a master key that only stream-api holds. The setting's name is part of the encryption, so a stored value moved onto another setting's row will not decrypt. The website and stream-ingest ask stream-api for the credentials they need. A browser never receives one.
If a stored credential will not decrypt, that one setting reports an error instead of quietly reading as empty, and an alarm is raised. If the master key is missing or wrong while credentials are stored, stream-api refuses to start. Every change is recorded in the settings history, never with a secret's value.
How a change reaches the running programs
The website and stream-ingest keep an internal connection to stream-api. After a setting is saved, stream-api sends a "settings changed" message on it, and each program reloads its settings. The website also reloads every 60 seconds, in case a message was missed. Settings that apply at once take effect on that reload. Settings that apply at a restart are read once when the program starts, and the panel shows a Pending restart box for them.
The list of settings that apply only at a restart comes from the same declaration as everything else. On the server, sudo blackbranch help prints the whole list, and sudo blackbranch status shows whether any saved change is still waiting for its restart.
Viewer settings
A viewer's settings are saved in their browser, so a page draws in the right look before anything else loads. A signed-in viewer's settings are also saved on the server, separately for desktop and phone: a bigger font chosen on the phone does not change the desktop. The streamer's chat window (/chat) and the OBS chat overlay share a third, separate set, so tuning the overlay never changes how chat looks on the site.
Modules
A module is a part of the product with its own on/off switch. A new install has four, all off: OBS control, YouTube, Card payments (Stripe) and PayPal and Venmo. You choose YouTube, Stripe and PayPal on the setup pages; OBS control is switched on later. Each switch heads its own feature's page in the Admin Panel: Utility → OBS, Platforms → YouTube, and the Stripe and PayPal cards on Payments → Connections.
Off is not uninstalled. A module that is off is not started: its addresses answer "not found", it makes no connections and writes nothing. Its tables and saved settings stay, so switching it back on picks up where it was. A payment module that is off answers its service's webhooks with "not found". Stripe and PayPal keep retrying a refused webhook for about three days, so switching back on within that time loses nothing. Supporter perks from that service stop while it is off (see Supporter subscriptions).
When a switch applies
Each switch is applied by the program that runs the module, when that program starts:
| Module | Applies when | Why |
|---|---|---|
| Card payments (Stripe), PayPal and Venmo | At once | Only the website reads these switches, and it reads them on every request |
| OBS control | When stream-api restarts | stream-api runs it: the rig page, scene reports and sound |
| YouTube | When stream-ingest restarts | stream-ingest reads YouTube chat. The website shows the YouTube parts from what stream-ingest is running, not from the saved switch |
Starting a module only at a program's start, once its settings have loaded from the database, avoids two problems:
- Starting on defaults would be wrong. If the database were slow at start-up, a program that started modules from its defaults would come up with everything off, and stay that way.
- Starting and stopping cleanly is hard. A module adds addresses to a running server and opens connections. Starting it once, in a known order, and leaving it until the next restart avoids half-started and half-stopped states.
After you flip a switch that needs a restart, its card shows which program is still waiting and offers a Restart button. On the server, the same is sudo blackbranch restart stream-api (or stream-ingest). The button works through the server's request folder; see How the site asks the server for things.
Some features that are not modules start and stop without a restart: the chat bot's Answer mentions and the help desk are started or stopped within seconds of the setting changing.
Adding your own code: the plugin seam
The product has one place in each program where a site plugin could add code of an install's own, such as extra AI slots, the channel's own emotes or extra Admin Panel pages, without changing the product's files. Published releases never carry a plugin, and the website's plugin is built into its image, so an install with a plugin has to build its own images from its own copy of the source and keep the plugin working across each release. An install from the published releases has no plugin, and everything works fully without one.
Next: Updates and the database