devise with omniauth - setting a seperate config for dev and production

Viewed 1794

I'm using omniauth, with devise, to allow sign on through Facebook in my app.

My devise.rb file has the following line

config.omniauth :facebook, 'MY_DEV_APP_ID', 'MY_DEV_APP_SECRET' 

I have 2 apps on facebook, one pointing to my live url & the other to my dev url.

How do I add two separate omniauth configs to the devise rb file?

something like -

if ENV['RAILS_ENV'] = "production"
    config.omniauth :facebook, 'MY_LIVE_APP_ID', 'MY_LIVE_APP_SECRET'  
else
    config.omniauth :facebook, 'MY_DEV_APP_ID', 'MY_DEV_APP_SECRET' 
end

More importantly, should I be putting this in the devise.tb file or should it be seperated into my production.rb & devleopment.rb files? If so, how do I reference it in my devise.rb file?

1 Answers
Related