default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: <%= ENV.fetch("DB_USERNAME", "") %>
  password: <%= ENV.fetch("DB_PASSWORD", "") %>
  host: localhost

development:
  <<: *default
  database: highway_dev

test:
  <<: *default
  database: highway_test

production:
  primary:
    url: <%= ENV['DATABASE_URL'] %>
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    timeout: 5000
  cache:
    url: <%= ENV['CACHE_DATABASE_URL'] || ENV['DATABASE_URL'] %>
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    timeout: 5000
    migrations_paths: db/cache_migrate
  queue:
    url: <%= ENV['QUEUE_DATABASE_URL'] || ENV['DATABASE_URL'] %>
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    timeout: 5000
    migrations_paths: db/queue_migrate
  cable:
    url: <%= ENV['CABLE_DATABASE_URL'] || ENV['DATABASE_URL'] %>
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    timeout: 5000
    migrations_paths: db/cable_migrate
