How to use YML values in a config/initializer

I'm working to integrate facebook in my app. To do that I'm using koala, devise, and omniauth.

For koala, I have

/config/facebook.yml

development:
    app_id: 123123132123
    secret_key: dasadsasd1231231
test:
    app_id: 313131313
    secret_key: das132asdads12132
production:
    app_id: dasdsadsadsadsa
    secret_key: adsdsa12das123fds21

I then also have with omniauth:

/config/initalizers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 123123132123, 'dasadsasd1231231'
end

Problem here is I have the same value repeated in both locations. How can I dry this up so that the app_id and secret_key only live in one place and one file references the other?

8
задан Cœur 3 February 2018 в 13:00
поделиться