-
-
Save linki/f7c83c09e339f8a68d56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
# 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