diff --git a/config/config.exs b/config/config.exs index 3b6757a..fe07fa4 100644 --- a/config/config.exs +++ b/config/config.exs @@ -11,7 +11,6 @@ config :gc_index_relay, ecto_repos: [GcIndexRelay.Repo], generators: [timestamp_type: :utc_datetime] - # Configure the endpoint config :gc_index_relay, GcIndexRelayWeb.Endpoint, url: [host: "localhost"], diff --git a/config/runtime.exs b/config/runtime.exs index 7cfcba9..f38c3cb 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -24,7 +24,7 @@ config :gc_index_relay, GcIndexRelayWeb.Endpoint, http: [port: String.to_integer(System.get_env("PORT", "4000"))] config :gc_index_relay, GcIndexRelay.Repo, - hostname: System.get_env("POSTGRES_HOST"), + hostname: System.get_env("POSTGRES_HOST") || "localhost", port: String.to_integer(System.get_env("POSTGRES_PORT") || "5432"), username: System.get_env("POSTGRES_USER"), password: System.get_env("POSTGRES_PASSWORD"), diff --git a/config/test.exs b/config/test.exs index 6e8d5ce..8c5450e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,6 +1,6 @@ import Config -config :gc_index_relay, :start_repo, true +config :gc_index_relay, :start_repo, System.get_env("REQUIRE_DB") == "true" # Configure your database # @@ -11,6 +11,9 @@ config :gc_index_relay, GcIndexRelay.Repo, username: System.get_env("POSTGRES_USER"), password: System.get_env("POSTGRES_PASSWORD"), database: "#{System.get_env("POSTGRES_DB")}#{System.get_env("MIX_TEST_PARTITION")}", + hostname: "localhost", + port: 5432, + show_sensitive_data_on_connection_error: true, pool: Ecto.Adapters.SQL.Sandbox, pool_size: System.schedulers_online() * 2