don't try to load airbrake if there is no config for it

This commit is contained in:
Sam 2013-03-11 16:59:07 -07:00
parent 2115c36c84
commit a0bdbe046a
5 changed files with 19 additions and 8 deletions

View File

@ -12,7 +12,7 @@ gem 'redcarpet', require: false
gem 'activerecord-postgres-hstore' gem 'activerecord-postgres-hstore'
gem 'acts_as_paranoid' gem 'acts_as_paranoid'
gem 'active_attr' # until we get ActiveModel::Model with Rails 4 gem 'active_attr' # until we get ActiveModel::Model with Rails 4
gem 'airbrake', '3.1.2' # errbit is broken with 3.1.3 for now gem 'airbrake', '3.1.2', require: false # errbit is broken with 3.1.3 for now
gem 'clockwork', require: false gem 'clockwork', require: false
gem 'em-redis' gem 'em-redis'
gem 'eventmachine' gem 'eventmachine'

14
config/airbrake.rb.sample Normal file
View File

@ -0,0 +1,14 @@
# Internally Dicourse uses Errbit for error logging,
# you can to by setting up an instance and amending this file
Airbrake.configure do |config|
config.api_key = 'YOUR API KEY'
config.host = 'errors.example.com'
config.port = 80
config.secure = config.port == 443
# IP Spoof errors can be ignored
config.ignore << "ActionDispatch::RemoteIp::IpSpoofAttackError"
end

View File

@ -33,12 +33,6 @@ Discourse::Application.configure do
config.ember.ember_location = "#{Rails.root}/app/assets/javascripts/external/ember.js" config.ember.ember_location = "#{Rails.root}/app/assets/javascripts/external/ember.js"
config.handlebars.precompile = false config.handlebars.precompile = false
# a bit hacky but works
config.after_initialize do
config.middleware.delete Airbrake::UserInformer
config.middleware.delete Airbrake::Rack
end
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -12,7 +12,7 @@ if defined?(PhusionPassenger)
if forked if forked
# We're in smart spawning mode. # We're in smart spawning mode.
$redis = DiscourseRedis.new $redis = DiscourseRedis.new
Discourse::Application.config.cache_store.reconnect# = DiscourseRedis.new_redis_store Discourse::Application.config.cache_store.reconnect
else else
# We're in conservative spawning mode. We don't need to do anything. # We're in conservative spawning mode. We don't need to do anything.
end end

View File

@ -0,0 +1,3 @@
if Rails.env.production? && File.exists?(Rails.root + '/config/airbrake.rb')
require 'airbrake'
end