Files
bridge/cmd
zeekay caa55ca609 feat(tenant): declarative tenant config — white-label shim pattern
Adds internal/tenant.Config: a single YAML primitive that drives brand,
IAM endpoint, KMS endpoint, MPC cluster, PQ profile, supported-chains
allowlist, basket allowlist, fee receiver, domain, and per-family
release-pool sizing. Same pattern Lux already uses for IAM (hanzo.id /
lux.id / zoo.id / pars.id) and KMS.

- internal/tenant/config.go (462 LOC): Config + per-section structs
  (Brand, Network, IAM, KMS, MPC, ReleasePool, FamilyPool); Load() +
  Parse() + Validate(); IsChainSupported() + IsBasketAllowed() helpers.
  Strict validation — daemon hard-fails on invalid config (no warn-
  and-continue path).

- internal/tenant/config_test.go (491 LOC): round-trip yaml, defaults
  applied, every required-field omission rejected, PQ profile must be
  one of strict-pq|classical-compat, FeeReceiverAddr must be 0x-prefixed
  20-byte hex, SupportedChains must be subset of the known family set,
  slug must be lowercase-hyphenated, IAM/KMS endpoints must be https://,
  MPC threshold can't exceed operators, basket allowlist validates.
  26 tests, all pass.

- cmd/bridge/main.go: --tenant-config flag (BRIDGE_TENANT_CONFIG env).
  When set, brand slug becomes the daemon log "service" tag + Fiber
  AppName; tenant defaults fill flags the operator didn't pass.
  Backwards-compatible: existing flag-driven deploys keep working.

- cmd/bridge/tenant_overrides.go: applyTenantOverrides — explicit
  flag wins, tenant fills gaps. flag.Visit-based, so we never
  clobber operator intent.

- cmd/bridge/main_test.go: TestTenantConfigFixture loads a complete
  tenant.yaml from disk and asserts it validates; TestTenantExampleYAMLLoads
  is a CI guardrail that the repo-root example file stays in sync
  with the schema.

- tenant.example.yaml: canonical commented schema. All four white-label
  shim repos (liquidity/bridge, hanzo/bridge-shim, zoo/bridge-shim,
  pars/bridge-shim) consume this shape.

Tests: ./... PASS — internal/tenant 0.282s, cmd/bridge 2.86s, full
suite green across 12 packages.
2026-05-28 01:24:15 -07:00
..