chore: adjust db conn to use injected env var
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
João Paulo Dubas 2024-09-25 10:22:34 +00:00
parent 067eb2ae0d
commit dd623a0547
No known key found for this signature in database
2 changed files with 12 additions and 4 deletions

View File

@ -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"

View File

@ -2,7 +2,8 @@ import Config
config :wabanex, Wabanex.Repo,
database: "wabanex_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: System.schedulers_online() * 2
config :wabanex, WabanexWeb.Endpoint,
http: [port: 4002],