mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
DRY and make database.yml more flexible
This enables us to fix https://github.com/openfoodfoundation/ofn-install/issues/387 and brings the needed flexibility so things like https://github.com/openfoodfoundation/openfoodnetwork/pull/3887 or any CI don't require a custom version. That's what ENV vars are for! For instance, I no longer need to mess with my LXC setup to connect to the DB. I just need to have 2 env vars.
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
default: &default
|
||||
defaults: &defaults
|
||||
adapter: postgresql
|
||||
encoding: utf8
|
||||
encoding: unicode
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
host: db
|
||||
port: 5432
|
||||
host: localhost
|
||||
username: <%= ENV.fetch('DB_USERNAME', 'ofn') %>
|
||||
password: <%= ENV.fetch('DB_PASSWORD', 'f00d') %>
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
<<: *defaults
|
||||
database: open_food_network_dev
|
||||
username: ofn
|
||||
password: f00d
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
<<: *defaults
|
||||
database: open_food_network_test
|
||||
username: ofn
|
||||
password: f00d
|
||||
|
||||
production:
|
||||
<<: *defaults
|
||||
database: open_food_network_prod
|
||||
|
||||
staging:
|
||||
<<: *defaults
|
||||
database: open_food_network_prod
|
||||
|
||||
Reference in New Issue
Block a user