chore: adjust db conn to use injected env var
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
@@ -30,7 +30,14 @@ import Config
|
||||
|
||||
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: System.get_env("POSTGRES_USER") || "postgres",
|
||||
password: System.get_env("POSTGRES_PASS") || "postgres",
|
||||
hostname: System.get_env("POSTGRES_HOST") || "localhost"
|
||||
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"
|
||||
|
Reference in New Issue
Block a user