lib/facebook_rails/engine.rb in facebook_rails-0.1.0 vs lib/facebook_rails/engine.rb in facebook_rails-0.1.1
- old
+ new
@@ -10,11 +10,17 @@
config.app_env = Rails.env
end
end
initializer "facebook_rails.facebook" do
- ::FACEBOOK = YAML.load_file(FacebookRails.app_root.join("config/facebook.yml"))[Rails.env]
- FACEBOOK.default = ''
+ begin
+ ::FACEBOOK = YAML.load_file(FacebookRails.app_root.join("config/facebook.yml"))[FacebookRails.app_env]
+ FACEBOOK.default = ''
+ rescue Exception => e
+ warn "WARNING: config/facebook.yml could not be loaded or a configuration is missing. Please run 'rails generate facebook_rails'."
+ ::FACEBOOK = {}
+ FACEBOOK.default = ''
+ end
::Koala.http_service.http_options[:timeout] = FACEBOOK[:timeout].to_i unless FACEBOOK[:timeout].blank?
::Koala::Facebook::OAuth.class_eval do
def initialize_with_default_settings(*args)