feat(brand): BRAND_* env scheme — instance branding without a rebuild #68

Merged
whitlocktech merged 1 commits from feature/brand-env into main 2026-07-18 07:40:07 +00:00
Member

Repo reorg Phase 4 — replace baked-in UOM/MysticMoon/UOMysticmoon branding with a BRAND_* env scheme. One prebuilt image runs as any shard; UOMysticmoon becomes the first tenant that sets these vars, not a special case in the code.

Architecture (app ships as a prebuilt image, so no build-time VITE_ vars)

  • server/src/config/brand.js + bot/src/brand.js read BRAND_* once at boot, Runic Gateway defaults.
  • Text/colors → SPA at runtime through the existing public settings API (settings.model.getPublicSiteContext) — no client rebuild. The admin-editable site title + contact email still override BRAND_NAME / BRAND_CONTACT_EMAIL.
  • SiteContext applies BRAND_ACCENT_COLOR to the --accent CSS var at runtime.
  • Express templates index.html <title>/description/OG/favicon at serve time (renderIndexHtml).
  • Server-side reads brand directly: emails, TOTP issuer, API docs, boot logs, error page. Bot: embed color + logs.

Assets

Logo/hero/favicon from a ./brand:/app/brand bind-mount (BRAND_LOGO/HERO/FAVICON), neutral defaults baked in; hero falls back to a built-in image when unset.

Full scope (per decision)

Also genericized package.json names (uomysticmoon-*runic-gateway-*, incl. lockfiles) and the DB_NAME/DB_USER/COOKIE_NAME code defaults (runic_gateway / runic / rg_token).

⚠️ Production keeps its real values by pinning them in .env. .env.uomysticmoon.example reproduces the exact UOMysticmoon identity + infra pinning (DB_NAME=uomysticmoon, DB_USER=uomm, COOKIE_NAME=uomm_token) — this is the proof the substitution works. Changing a deployed COOKIE_NAME logs users out, so UOMysticmoon keeps uomm_token. The MariaDB volume/DB name is unchanged; the app still connects to the same database.

BRAND_* schema

BRAND_NAME, BRAND_SHORT_NAME, BRAND_TAGLINE, BRAND_DESCRIPTION, BRAND_CONTACT_EMAIL, BRAND_URL, BRAND_ACCENT_COLOR, BRAND_LOGO, BRAND_HERO, BRAND_FAVICON. Documented in .env.example + README Branding section.

Verified

  • 193 server tests pass
  • client builds
  • app.js loads and templates the built index.html without throwing
  • brand transform injects title/description/OG/favicon (checked against a sample BRAND_NAME)
  • OpenAPI spec regenerated with clean defaults (0 stale uomm_token/UOMysticmoon)

Left intentionally: test fixtures using UOMysticmoon/uom.example as sample data, and the uomysticmoon-main-hero.png asset (referenced by the UOMysticmoon BRAND_HERO).

🤖 Generated with Claude Code

Repo reorg **Phase 4** — replace baked-in `UOM`/`MysticMoon`/`UOMysticmoon` branding with a `BRAND_*` env scheme. One prebuilt image runs as any shard; **UOMysticmoon becomes the first tenant** that sets these vars, not a special case in the code. ## Architecture (app ships as a prebuilt image, so no build-time `VITE_` vars) - **`server/src/config/brand.js`** + **`bot/src/brand.js`** read `BRAND_*` once at boot, Runic Gateway defaults. - **Text/colors → SPA at runtime** through the existing public settings API (`settings.model.getPublic` → `SiteContext`) — **no client rebuild**. The admin-editable **site title** + **contact email** still override `BRAND_NAME` / `BRAND_CONTACT_EMAIL`. - **`SiteContext`** applies `BRAND_ACCENT_COLOR` to the `--accent` CSS var at runtime. - **Express templates `index.html`** `<title>`/description/OG/favicon at serve time (`renderIndexHtml`). - **Server-side reads brand directly:** emails, TOTP issuer, API docs, boot logs, error page. Bot: embed color + logs. ## Assets Logo/hero/favicon from a **`./brand:/app/brand` bind-mount** (`BRAND_LOGO/HERO/FAVICON`), neutral defaults baked in; hero falls back to a built-in image when unset. ## Full scope (per decision) Also genericized **package.json names** (`uomysticmoon-*` → `runic-gateway-*`, incl. lockfiles) and the **`DB_NAME`/`DB_USER`/`COOKIE_NAME` code defaults** (`runic_gateway` / `runic` / `rg_token`). > ⚠️ **Production keeps its real values by pinning them in `.env`.** [`.env.uomysticmoon.example`](.env.uomysticmoon.example) reproduces the exact UOMysticmoon identity + infra pinning (`DB_NAME=uomysticmoon`, `DB_USER=uomm`, `COOKIE_NAME=uomm_token`) — this is the proof the substitution works. **Changing a deployed `COOKIE_NAME` logs users out**, so UOMysticmoon keeps `uomm_token`. The MariaDB volume/DB name is unchanged; the app still connects to the same database. ## `BRAND_*` schema `BRAND_NAME`, `BRAND_SHORT_NAME`, `BRAND_TAGLINE`, `BRAND_DESCRIPTION`, `BRAND_CONTACT_EMAIL`, `BRAND_URL`, `BRAND_ACCENT_COLOR`, `BRAND_LOGO`, `BRAND_HERO`, `BRAND_FAVICON`. Documented in `.env.example` + README **Branding** section. ## Verified - ✅ 193 server tests pass - ✅ client builds - ✅ `app.js` loads and templates the built `index.html` without throwing - ✅ brand transform injects title/description/OG/favicon (checked against a sample `BRAND_NAME`) - ✅ OpenAPI spec regenerated with clean defaults (0 stale `uomm_token`/`UOMysticmoon`) Left intentionally: test fixtures using `UOMysticmoon`/`uom.example` as sample data, and the `uomysticmoon-main-hero.png` asset (referenced by the UOMysticmoon `BRAND_HERO`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wtclaude added 1 commit 2026-07-18 07:20:28 +00:00
feat(brand): BRAND_* env scheme — instance branding without a rebuild
All checks were successful
PR Checks / client-build (pull_request) Successful in 9m24s
PR Checks / server-tests (pull_request) Successful in 10m33s
PR Checks / bot-install (pull_request) Successful in 9m20s
7a08546da6
Replace baked-in UOM/MysticMoon/UOMysticmoon branding with a BRAND_* env
scheme so one prebuilt image runs as any shard; UOMysticmoon becomes the
first tenant that sets these vars rather than a special case in the code.

Architecture (chosen because the app ships as a prebuilt image):
- server/src/config/brand.js + bot/src/brand.js read BRAND_* once at boot,
  with Runic Gateway defaults.
- Text/colors reach the SPA at RUNTIME through the existing public settings
  API (settings.model.getPublic -> SiteContext), so no client rebuild. The
  admin-editable site title + contact email still override BRAND_NAME/email.
- SiteContext applies BRAND_ACCENT_COLOR to the --accent CSS var at runtime.
- Express templates the built index.html <title>/description/OG/favicon at
  serve time from BRAND_* (renderIndexHtml in app.js).
- Server-side consumers read brand directly: emails, TOTP issuer, API docs,
  boot logs, HTML error page. Bot uses it for embed color + logs.

Assets: logo/hero/favicon delivered from a ./brand:/app/brand bind-mount
(BRAND_LOGO/HERO/FAVICON), with neutral defaults baked in; hero falls back
to a built-in image when unset.

Scope: also genericized package.json names (uomysticmoon-* -> runic-gateway-*)
and the DB_NAME/DB_USER/COOKIE_NAME code defaults (runic_gateway/runic/
rg_token). Production keeps its real values by pinning them in .env — see
.env.uomysticmoon.example, which reproduces the exact UOMysticmoon identity
(proof the substitution works). Changing a deployed COOKIE_NAME invalidates
existing sessions, so UOMysticmoon pins uomm_token.

Verified: 193 server tests pass, client builds, app.js loads + templates the
built index.html, brand transform injects title/description/OG/favicon.
whitlocktech approved these changes 2026-07-18 07:31:52 +00:00
whitlocktech scheduled this pull request to auto merge when all checks succeed 2026-07-18 07:31:57 +00:00
whitlocktech merged commit a16092f13a into main 2026-07-18 07:40:07 +00:00
whitlocktech deleted branch feature/brand-env 2026-07-18 07:40:07 +00:00
Sign in to join this conversation.
No description provided.