Skip to content

Instantly share code, notes, and snippets.

@nicbet
Created April 3, 2019 01:56
Show Gist options
  • Save nicbet/8fd4a487c01eb1c0db6cac9552be9561 to your computer and use it in GitHub Desktop.
Save nicbet/8fd4a487c01eb1c0db6cac9552be9561 to your computer and use it in GitHub Desktop.
DRY Database Config for Rails
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: <%= ENV.fetch("DB_USER") { "postgres" } %>
password: <%= ENV.fetch("DB_PASSWORD") { "postgres" } %>
host: <%= ENV.fetch("DB_HOST") { "localhost" } %>
port: <%= ENV.fetch("DB_PORT") { 5432 } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment