Files
paliad/internal/branding/firm.go
m 495e519475 feat(t-paliad-065): firm-agnostic branding via single FIRM_NAME constant
Paliad ships firm-agnostic per CLAUDE.md ("survives firm renames") but
landing copy, email templates, page titles, and form placeholders still
hard-coded "Hogan Lovells" / "HL Patents". Replaces every user-facing
firm reference with a single source of truth: internal/branding.Name on
the server and frontend/src/branding.ts in the bundle, both reading
FIRM_NAME at startup/build time and defaulting to "HLC".

Server: branding package + boot log; auth, invite, admin_users error
strings; courts/offices/models comments; mail templates thread
{{.Firm}} via injected payload default. Files handler keeps the
upstream "HL Patents Style.dotm" path (must match mWorkRepo's blob
name) but renders the user-visible DownloadName from branding.Name.

Frontend: branding.ts read via Bun.build define so process.env.FIRM_NAME
is statically substituted into client bundles (no runtime process
reference); index/login/downloads/kostenrechner/Sidebar/ProjectFormFields
and every i18n.ts string templated against ${FIRM}.

ALLOWED_EMAIL_DOMAINS whitelist intentionally untouched — email
domains and display name rotate independently.

Verified: go build/vet/test clean; bun run build clean; FIRM_NAME=Acme
override produces "Acme" in HTML and JS bundles end-to-end.
2026-04-28 22:44:06 +02:00

33 lines
1.2 KiB
Go

// Package branding is the single source of truth for the firm name that
// Paliad's UI, emails, and download metadata render. Paliad is firm-agnostic
// (per the project CLAUDE.md — "survives firm renames"); reading the name
// through this package keeps every surface in sync and lets a redeploy with
// a different FIRM_NAME repoint the whole product without code changes.
//
// Default is "HLC" (current firm). Override with the FIRM_NAME env var.
//
// History: until 2026-04-16 this codebase shipped "Hogan Lovells" / "HL"
// hard-coded across server templates and the frontend. The merger announced
// that month made those references stale and the rebrand to Paliad-the-name
// + branding.Name-as-runtime-value followed (t-paliad-065).
package branding
import (
"os"
"strings"
)
// Name is the firm Paliad is being branded for in this deployment. Read once
// at process start so handler hot paths don't pay the env-lookup cost.
//
// Consumers must treat it as a constant for the lifetime of the process — if
// FIRM_NAME changes on disk, that's a redeploy, not a hot-reload.
var Name = resolveName()
func resolveName() string {
if v := strings.TrimSpace(os.Getenv("FIRM_NAME")); v != "" {
return v
}
return "HLC"
}