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 # K8s cluster connection (future — orchestrator will use this) # config :guildhall_orchestrator, # kubeconfig: System.get_env("KUBECONFIG") || "~/.kube/config", # context: System.get_env("K8S_CONTEXT") # Keycloak OIDC (future — auth) # config :guildhall_web, :oidc, # issuer: System.get_env("OIDC_ISSUER") || "https://auth.guildhouse.dev/realms/guildhouse", # client_id: System.get_env("OIDC_CLIENT_ID"), # client_secret: System.get_env("OIDC_CLIENT_SECRET") end