ex_trainer/config/runtime.exs
Joao P Dubas dd623a0547
Some checks failed
continuous-integration/drone/pr Build is failing
chore: adjust db conn to use injected env var
2024-09-25 10:22:34 +00:00

44 lines
1.3 KiB
Elixir

import Config
# [warn] Conditional IPv6 support missing from runtime configuration.
#
# Add the following to your config/runtime.exs:
#
# maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
#
# config :wabanex, Wabanex.Repo,
# ...,
# socket_options: maybe_ipv6
#
# [warn] Conditional server startup is missing from runtime configuration.
#
# Add the following to the top of your config/runtime.exs:
#
# if System.get_env("PHX_SERVER") do
# config :wabanex, WabanexWeb.Endpoint, server: true
# end
#
# [warn] Environment based URL export is missing from runtime configuration.
#
# Add the following to your config/runtime.exs:
#
# host = System.get_env("PHX_HOST") || "example.com"
#
# config :wabanex, WabanexWeb.Endpoint,
# ...,
# url: [host: host, port: 443]
config :wabanex, dns_cluster_query: System.get_env("DNS_CLUSTER_QUERY") || :ignore
get_multi_env = fn varnames, default ->
varnames
|> Enum.reduce(nil, &(System.get_env(&1) || &2))
|> Kernel.||(default)
end
config :wabanex, Wabanex.Repo,
username: multi_get_env.(["DB_USER", "POSTGRES_USER"], "postgres"),
password: multi_get_env.(["DB_PASSWORD", "POSTGRES_PASS"], "postgres"),
hostname: multi_get_env.(["DB_HOST", "POSTGRES_HOST"], "localhost"),
port: System.get_env("DB_PORT") || "5432"