customink / secondbase

Seamless second database integration for Rails.
MIT License
220 stars 31 forks source link

Allow ENV setting for SecondBase connection #28

Closed agrberg closed 8 years ago

agrberg commented 8 years ago

This is modeled after how ActiveRecord gives priority to a ENV['DATABASE_URL] connection. It allows the same flexibility of not having your production credentials in your database.yml file.

agrberg commented 8 years ago

I'd happily add tests for this but I cannot get the tests to run locally without a number of failures out of the box. I believe I do not have the test env configured correctly but I only have time to look into it more in depth later.

metaskills commented 8 years ago

I just updated the docs with how Rails lets Twelve-Factor configuration win for ActiveRecord::Base and SecondBase. Please check it out. https://github.com/customink/secondbase/blob/master/README.md#twelve-factor--database_url

We prefer this technique vs adding ENV vars to SecondBase itself.

metaskills commented 8 years ago

This is another link on the topic. https://github.com/rails/rails/commit/5b96027ef6ac6e507ec9caf9973069345ce6a7cd

agrberg commented 8 years ago

👍 Did not know about that option! Thanks and I'll close this as I can get exactly what I need with that approach.

metaskills commented 8 years ago

Thanks too! I needed this reminder to get those docs in place. Really appreciate you bringing up the topic. Cheers!