Browse Source

Define DB connection strings in runtime config

master
buttercat1791 2 months ago
parent
commit
0c52ae8f31
  1. 8
      config/config.exs
  2. 7
      config/runtime.exs

8
config/config.exs

@ -11,14 +11,6 @@ config :gc_index_relay, @@ -11,14 +11,6 @@ config :gc_index_relay,
ecto_repos: [GcIndexRelay.Repo],
generators: [timestamp_type: :utc_datetime]
config :gc_index_relay, GcIndexRelay.Repo,
username: System.get_env("POSTGRES_ADMIN_USER"),
password: System.get_env("POSTGRES_ADMIN_PASSWORD"),
database: System.get_env("POSTGRES_DB"),
hostname: System.get_env("POSTGRES_HOST"),
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# Configure the endpoint
config :gc_index_relay, GcIndexRelayWeb.Endpoint,

7
config/runtime.exs

@ -23,6 +23,13 @@ end @@ -23,6 +23,13 @@ end
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"),
port: String.to_integer(System.get_env("POSTGRES_PORT") || "5432"),
username: System.get_env("POSTGRES_USER"),
password: System.get_env("POSTGRES_PASSWORD"),
database: System.get_env("POSTGRES_DB")
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||

Loading…
Cancel
Save