diff --git a/config/runtime.exs b/config/runtime.exs index bc5dec1..3d4b9be 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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" diff --git a/config/test.exs b/config/test.exs index 4b124fa..be3d427 100644 --- a/config/test.exs +++ b/config/test.exs @@ -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],