guildhall/config/runtime.exs
Tyler J King c0959a5376 feat(guildhall): minimum viable guildhall — OIDC, guilds, schematics, members
Implements the full founding-guild onboarding stack across four phases:

Phase A — Keycloak OIDC auth pipeline (oidcc) + guild registration with
ceremony-engine approval (SingleApproval, hub operator approves via gRPC).
Phase B — Founding schematic templates (MSP/ISV/NSP TOML), gRPC clients
for ceremony-service and ffc-schematic-server, schematic fork/bind/realize
LiveView with DB audit trail in guild_schematics.
Phase C — RealizationPoller GenServer polling realization status every 5s,
PubSub broadcast, live realization dashboard showing 7 reconciler sections.
Phase D — Self-service member onboarding (join request → guild master
approval via ceremony), member management LiveView, auto-create guild
master on guild approval via Ecto.Multi transaction.

Includes K8s manifests for ceremony-service (port 50053) and
ffc-schematic-server (port 9091) as ClusterIP services, plus updated
guildhall deployment with OIDC and gRPC service URL env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Tyler J King <tking@guildhouse.dev>
2026-05-15 15:03:50 -04:00

62 lines
2.1 KiB
Elixir

import Config
# config/runtime.exs is executed for all environments, including during
# releases. It runs after compilation and before the system starts, so
# it's ideal for loading configuration from environment variables.
if System.get_env("PHX_SERVER") do
config :guildhall_web, GuildhallWeb.Endpoint, server: true
end
config :guildhall_web, GuildhallWeb.Endpoint,
http: [port: String.to_integer(System.get_env("PORT", "4000"))]
if config_env() == :prod do
# Ops DB — Postgres
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :guildhall_ops_db, Guildhall.OpsDb.Repo,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
host = System.get_env("PHX_HOST") || "guildhall.guildhouse.dev"
config :guildhall_web, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :guildhall_web, GuildhallWeb.Endpoint,
url: [host: host, port: 443, scheme: "https"],
http: [ip: {0, 0, 0, 0, 0, 0, 0, 0}],
secret_key_base: secret_key_base
config :guildhall_web, :oidc,
issuer:
System.get_env("OIDC_ISSUER") || "https://auth.guildhouse.dev/realms/guildhouse",
client_id: System.get_env("OIDC_CLIENT_ID") || "guildhall-web",
client_secret: System.get_env("OIDC_CLIENT_SECRET"),
redirect_uri:
System.get_env("OIDC_REDIRECT_URI") ||
"https://guildhall.guildhouse.dev/auth/callback"
config :guildhall_orchestrator,
ceremony_service_url:
System.get_env("CEREMONY_SERVICE_URL") || "localhost:50053",
schematic_service_url:
System.get_env("SCHEMATIC_SERVICE_URL") || "localhost:9091",
ffc_schematic_service_url:
System.get_env("FFC_SCHEMATIC_SERVICE_URL") || "localhost:9091"
end