namespace ControlPlane.Core.Config; /// /// Central configuration for all infrastructure URLs, network names, and domain values. /// Bind from the "Clarity" section in appsettings.json or via AppHost environment variables. /// Eliminates hardcoded strings spread across Worker, AppHost, and generated configs. /// public sealed class ClarityInfraOptions { public const string Section = "Clarity"; // ── Domain ──────────────────────────────────────────────────────────── /// The base DNS domain for all tenant subdomains. e.g. "clarity.test" public string Domain { get; set; } = "clarity.test"; /// The Docker network all managed containers are attached to. public string Network { get; set; } = "clarity-net"; // ── Keycloak ────────────────────────────────────────────────────────── /// Public browser-facing Keycloak URL — used in redirect URIs and JWT iss claim. public string KeycloakPublicUrl { get; set; } = "https://keycloak.clarity.test"; /// Internal Docker DNS URL for server-side Keycloak calls (avoids self-signed cert). public string KeycloakInternalUrl { get; set; } = "http://keycloak:8080"; // ── Vault ───────────────────────────────────────────────────────────── /// Internal Docker DNS URL for Vault — injected into tenant containers. public string VaultInternalUrl { get; set; } = "http://vault:8200"; // ── nginx SSL certs ─────────────────────────────────────────────────── /// Path to the wildcard TLS cert inside the nginx container. public string NginxCertPath { get; set; } = "/etc/nginx/certs/clarity.test.crt"; /// Path to the wildcard TLS key inside the nginx container. public string NginxCertKeyPath { get; set; } = "/etc/nginx/certs/clarity.test.key"; // ── Helpers ─────────────────────────────────────────────────────────── /// Builds the public tenant URL for a given subdomain. public string TenantPublicUrl(string subdomain) => $"https://{subdomain}.{Domain}"; /// Builds the public Keycloak realm URL for a given realm (browser-facing). public string KeycloakRealmPublicUrl(string realm) => $"{KeycloakPublicUrl}/realms/{realm}"; /// Builds the internal Keycloak realm URL for a given realm (server-side). public string KeycloakRealmInternalUrl(string realm) => $"{KeycloakInternalUrl}/realms/{realm}"; }