Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Last active August 29, 2015 14:23
Show Gist options
  • Save jpotts18/210e88e7468be60d4a03 to your computer and use it in GitHub Desktop.
Save jpotts18/210e88e7468be60d4a03 to your computer and use it in GitHub Desktop.
<% require "uri" %>
db_config: &db_config
<% if ENV["DATABASE_URL"].present? %>
<% uri = URI.parse(ENV["DATABASE_URL"]) if ENV["DATABASE_URL"].present? %>
username: <%= uri.user %>
password: <%= uri.password %>
host: <%= uri.host %>
<% else %>
username: root
password: root
host: localhost
<% end %>
adapter: mysql2
pool: 10
timeout: 5000
port: 3306
development:
<<: *db_config
database: app_dev
test:
<<: *db_config
database: app_test
staging:
<<: *db_config
database: app_staging
production:
<<: *db_config
database: app_production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment