Skip to content

Commit

Permalink
Read facebook settings from ENV object
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinquist committed Dec 20, 2011
1 parent 9788700 commit 45a2025
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.haml
Expand Up @@ -19,7 +19,7 @@
:javascript
window.fbAsyncInit = function() {
FB.init({
appId: #{Settings.facebook.app_id},
appId: #{ENV['FACEBOOK_APP_ID']},
status: true,
cookie: true,
oauth: true,
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Expand Up @@ -20,6 +20,9 @@ class Application < Rails::Application
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib)

ENV['FACEBOOK_APP_ID'] = '322201971143207' unless ENV.has_key?('FACEBOOK_APP_ID')
ENV['FACEBOOK_APP_SECRET'] = '7cc00eab6bf9bd8f31dd4132b43455bd' unless ENV.has_key?('FACEBOOK_APP_SECRET')

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
Expand Down
2 changes: 1 addition & 1 deletion lib/facebook_auth.rb
Expand Up @@ -20,7 +20,7 @@ def require_login
end

def facebook_auth
@oauth = Koala::Facebook::OAuth.new(Settings.facebook.app_id, Settings.facebook.app_secret)
@oauth = Koala::Facebook::OAuth.new(ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'])

begin
fb_user_info = @oauth.get_user_info_from_cookie(request.cookies)
Expand Down

0 comments on commit 45a2025

Please sign in to comment.