Last active
August 29, 2015 14:26
-
-
Save linki/67c91554906c22457895 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}?encoding=unicode&pool=5" | |
| end | |
| # first checks if there's an env var defining the database | |
| # then falls back to using the default database for the env | |
| def database(env) | |
| ENV.fetch('DATABASE_URL') { default_database(env) } | |
| end | |
| %> | |
| default: &default | |
| url: <%= database(Rails.env) %> | |
| development: | |
| <<: *default | |
| test: | |
| <<: *default | |
| production: | |
| <<: *default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment