Last active
March 27, 2019 21:23
-
-
Save zparnold/dfd509191b54281d2c4843cbbea1fa90 to your computer and use it in GitHub Desktop.
An extendable, DRY Rails database file
This file contains 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
#chances are you use the same port and adapter everywhere | |
default: &default | |
adapter: mysql2 | |
reconnect: true | |
port: 3306 | |
#we use docker compose locally, so these settings stay the same | |
local: &local | |
<<: *default | |
username: root | |
password: | |
host: db | |
#we use AWS for hosting, but as long as these env vars are present, you can use any provider | |
remote: &remote | |
<<: *default | |
database: <%= ENV['DATABASE'] %> | |
username: <%= ENV['DB_USER'] %> | |
password: <%= ENV['DB_PASSWORD'] %> | |
host: <%= ENV['DB_HOST'] %> | |
pool: 25 | |
#we use SSL connections to our RDS instance, so we setup a verification key, but if you have everything locked down, | |
#you probably won't need these next two lines | |
sslca: '/var/rds-combined-ca-bundle.pem' | |
sslverify: true | |
#finally, we define environment specific settings below | |
development: | |
<<: *local | |
database: ygrene_development | |
test: | |
<<: *default | |
database: ygrene_test | |
staging: | |
<<: *remote | |
production: | |
<<: *remote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment