Skip to content

Instantly share code, notes, and snippets.

@linki
Created July 31, 2015 12:20
Show Gist options
  • Save linki/f7c83c09e339f8a68d56 to your computer and use it in GitHub Desktop.
Save linki/f7c83c09e339f8a68d56 to your computer and use it in GitHub Desktop.
<%
# default database without credentials, suffixed with env
def default_database(env)
"postgres://localhost:5432/openproject_#{env}"
end
# first checks if there's an env var defining the database
# falls back to using the default database
def database(env)
ENV.fetch('DATABASE_URL') { default_database(env) }
end
%>
default: &default
encoding: unicode
pool: 5
development:
<<: *default
url: <%= database('development') %>
test:
<<: *default
url: <%= database('test') %>
production:
<<: *default
url: <%= database('production') %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment