From a0bdbe046a89211af8f2198d355b6900822b7472 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Mar 2013 16:59:07 -0700 Subject: [PATCH] don't try to load airbrake if there is no config for it --- Gemfile | 2 +- config/airbrake.rb.sample | 14 ++++++++++++++ config/environments/development.rb | 6 ------ config/initializers/01-redis.rb | 2 +- config/initializers/airbrake.rb | 3 +++ 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 config/airbrake.rb.sample create mode 100644 config/initializers/airbrake.rb diff --git a/Gemfile b/Gemfile index 3b6802c6dbe..df7f8bed48e 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'redcarpet', require: false gem 'activerecord-postgres-hstore' gem 'acts_as_paranoid' 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 'em-redis' gem 'eventmachine' diff --git a/config/airbrake.rb.sample b/config/airbrake.rb.sample new file mode 100644 index 00000000000..c440d01d765 --- /dev/null +++ b/config/airbrake.rb.sample @@ -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 + diff --git a/config/environments/development.rb b/config/environments/development.rb index 9fd57f9ebb4..d95edcae476 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -33,12 +33,6 @@ Discourse::Application.configure do config.ember.ember_location = "#{Rails.root}/app/assets/javascripts/external/ember.js" 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.smtp_settings = { :address => "localhost", :port => 1025 } config.action_mailer.raise_delivery_errors = true diff --git a/config/initializers/01-redis.rb b/config/initializers/01-redis.rb index 9fcc439fafb..eaff97f45a0 100644 --- a/config/initializers/01-redis.rb +++ b/config/initializers/01-redis.rb @@ -12,7 +12,7 @@ if defined?(PhusionPassenger) if forked # We're in smart spawning mode. $redis = DiscourseRedis.new - Discourse::Application.config.cache_store.reconnect# = DiscourseRedis.new_redis_store + Discourse::Application.config.cache_store.reconnect else # We're in conservative spawning mode. We don't need to do anything. end diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb new file mode 100644 index 00000000000..e9d00307896 --- /dev/null +++ b/config/initializers/airbrake.rb @@ -0,0 +1,3 @@ +if Rails.env.production? && File.exists?(Rails.root + '/config/airbrake.rb') + require 'airbrake' +end