rouse-context/core
Jason Monk ca5d1cab13 Fix #70: Parameterize base domain for self-hosting
Extract the hardcoded "rousecontext.com" base domain to a single Gradle
property (`-Pdomain`) that flows through BuildConfig to all Kotlin call
sites, and to a matching optional config field on the Rust relay. A fork
can now point a deployment at their own domain by setting one value.

Kotlin:
- New `BASE_DOMAIN` buildConfigField in :app, driven by `-Pdomain`
  Gradle property (default "rousecontext.com"). `RELAY_HOST` derives
  from it unless `-Prelay.host` is set explicitly.
- `McpUrlProvider` default reads `BuildConfig.BASE_DOMAIN`.
- `AppModule` session hostname uses `BuildConfig.BASE_DOMAIN` directly
  instead of stripping "relay." from `RELAY_HOST`.
- `CertProvisioningFlow` / `CertRenewalFlow` / `CtLogMonitor` accept
  base domain via constructor (still with a safe default so tests don't
  need to change).

Rust relay:
- New `base_domain` field on `ServerConfig`. Empty (default) means
  "derive by stripping 'relay.' from relay_hostname" -- the existing
  convention. Operators with non-conforming hostnames can set it.
- `ServerConfig::resolved_base_domain()` helper centralizes the lookup.
- `RELAY_BASE_DOMAIN` env var override.
- Removed duplicate `strip_prefix("relay.")` logic in main.rs, api/register.rs,
  api/renew.rs in favor of the helper.

Docs:
- `docs/self-hosting.md` walks through Cloudflare + Firebase + keystore
  setup, Android build with `-Pdomain=...`, Rust relay cross-compile and
  systemd deployment, and verification steps.

Test fixtures (test-only hostnames like "test.rousecontext.com",
@Preview composables, e2e helpers) remain as-is -- they're load-bearing
assertions about the URL format, not deployment-specific constants.

Verified:
- ./gradlew :app:compileDebugKotlin ktlintCheck :app:testDebugUnitTest
- ./gradlew -Pdomain=example.com :app:compileDebugKotlin (BuildConfig
  shows BASE_DOMAIN="example.com", RELAY_HOST="relay.example.com")
- ./gradlew -Pdomain=example.com :app:testDebugUnitTest (still green)
- cd relay && cargo test && cargo clippy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 13:06:07 -04:00
..
bridge Fix #8: Reimplement ClientPassthroughTest 2026-04-11 11:42:59 -04:00
mcp Fix #74: Replace polling loop in AuthorizationApprovalViewModel with Flow to fix test hang 2026-04-12 12:46:18 -04:00
tunnel Fix #70: Parameterize base domain for self-hosting 2026-04-12 13:06:07 -04:00