Skip to content

Instantly share code, notes, and snippets.

@neerajsingh0101
Last active July 11, 2020 01:08
Show Gist options
  • Save neerajsingh0101/c09a2346fdce525a770cd8729bb19926 to your computer and use it in GitHub Desktop.
Save neerajsingh0101/c09a2346fdce525a770cd8729bb19926 to your computer and use it in GitHub Desktop.
<% branch_name = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '') %>
<% repository_name = `git rev-parse --show-toplevel`.split('/').last.strip %>
default: &default
adapter: postgresql
encoding: unicode
host: localhost
pool: 5
password:
development:
<<: *default
database: <%= "#{repository_name}_development" %>
test:
<<: *default
database: <%= "#{repository_name}_test" %>
staging:
<<: *default
database: <%= "#{repository_name}_staging" %>
production:
<<: *default
database: <%= "#{repository_name}_production" %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment