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:
Pau Perez
2019-06-18 11:01:58 +02:00
committed by Matt-Yorkley
parent 592a468448
commit 7ee41902f2

View File

@@ -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