I am unable to read the variables I defined in environment.rb file for omniauth.
This is my code:
environment.rb
ENV['LINKEDIN_KEY'] = "key"
ENV['LINKEDIN_SECRET'] = "secret"
omniauth.rb initializer
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :linkedin, ENV['linkedin_key'], ENV['linkedin_secret']
end
This only works for me if I hard code the key and secret. I am using Rails 4 and Ruby 2.
In the main example of omniauth they used it the same way:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :developer unless Rails.env.production?
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
end
I would love some help. Thanks.