Commit 3659a05e47749acee437b68317f0c26baaa74cfa

Authored by Nathan Broadbent
1 parent 5e7f599f
Exists in master and in 1 other branch production

Removed the option to send Errbit's errors elsewhere. All internal Errbit errors…

… are now stored in an automatically created app called 'Self.Errbit'.
config/config.example.yml
@@ -44,14 +44,3 @@ user_has_username: false @@ -44,14 +44,3 @@ user_has_username: false
44 # :user_name: USERNAME 44 # :user_name: USERNAME
45 # :password: PASSWORD 45 # :password: PASSWORD
46 46
47 -  
48 -# Configure tracking for Errbit's own internal errors.  
49 -# By default, Errbit will log it's own errors to an internal App named 'Self.Errbit'.  
50 -# The 'Self.Errbit' app will be automatically created whenever the first error happens.  
51 -# Uncomment this section if you would rather send error reports to our central Errbit instance.  
52 -# ---------------------------------------------------------------------------------------------  
53 -#report_self_errors: true  
54 -#self_errors_host: errbit-central.heroku.com  
55 -#self_errors_port: 80  
56 -#self_errors_api_key: 11e5ce322856e540481e6a0789893179  
57 -  
config/initializers/_load_config.rb
@@ -9,11 +9,6 @@ if ENV['HEROKU'] @@ -9,11 +9,6 @@ if ENV['HEROKU']
9 Errbit::Config.email_at_notices = [1,3,10] #ENV['ERRBIT_EMAIL_AT_NOTICES'] 9 Errbit::Config.email_at_notices = [1,3,10] #ENV['ERRBIT_EMAIL_AT_NOTICES']
10 Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR'] 10 Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR']
11 11
12 - Errbit::Config.report_self_errors = ENV['ERRBIT_REPORT_SELF_ERRORS']  
13 - Errbit::Config.self_errors_host = ENV['ERRBIT_SELF_ERRORS_HOST']  
14 - Errbit::Config.self_errors_port = ENV['ERRBIT_SELF_ERRORS_PORT']  
15 - Errbit::Config.self_errors_api_key = ENV['ERRBIT_SELF_ERRORS_API_KEY']  
16 -  
17 Errbit::Config.smtp_settings = { 12 Errbit::Config.smtp_settings = {
18 :address => "smtp.sendgrid.net", 13 :address => "smtp.sendgrid.net",
19 :port => "25", 14 :port => "25",
config/initializers/hoptoad.rb
1 HoptoadNotifier.configure do |config| 1 HoptoadNotifier.configure do |config|
2 - config.api_key = Errbit::Config.self_errors_api_key || "11e5ce322856e540481e6a0789893179"  
3 - config.host = Errbit::Config.self_errors_host || "errbit-central.heroku.com"  
4 - config.port = Errbit::Config.self_errors_port || 80  
5 - config.secure = config.port == 443 2 + # Internal Errbit errors are stored locally, but we need
  3 + # to set a dummy API key so that HoptoadNotifier doesn't complain.
  4 + config.api_key = "---------"
6 end 5 end
7 6
lib/overrides/hoptoad_notifier/hoptoad_notifier.rb
@@ -5,31 +5,25 @@ @@ -5,31 +5,25 @@
5 HoptoadNotifier.module_eval do 5 HoptoadNotifier.module_eval do
6 class << self 6 class << self
7 private 7 private
8 - def send_notice_with_internal(notice)  
9 - if Errbit::Config.report_self_errors.to_s == "true"  
10 - # Using the original method, send notice to a different Errbit instance.  
11 - send_notice_without_internal(notice)  
12 - else  
13 - # Otherwise, if we are not in a development environment, log the error internally.  
14 - if configuration.public?  
15 - begin  
16 - app = App.find_or_initialize_by(:name => "Self.Errbit")  
17 - if app.new?  
18 - app.github_url = "https://github.com/errbit/errbit.git"  
19 - app.save!  
20 - end  
21 - notice.send("api_key=", app.api_key)  
22 - # Create notice internally.  
23 - # 'to_xml ~> from_xml' provides a data bridge between hoptoad_notifier and Errbit.  
24 - ::Notice.from_xml(notice.to_xml)  
25 - logger.info "Internal error was logged to 'Self.Errbit' app."  
26 - rescue  
27 - logger.error "-- Errbit crashed while processing an internal error!" if logger 8 + def send_notice(notice)
  9 + # Log the error internally if we are not in a development environment.
  10 + if configuration.public?
  11 + begin
  12 + app = App.find_or_initialize_by(:name => "Self.Errbit")
  13 + if app.new?
  14 + app.github_url = "https://github.com/errbit/errbit.git"
  15 + app.save!
28 end 16 end
  17 + notice.send("api_key=", app.api_key)
  18 + # Create notice internally.
  19 + # 'to_xml ~> from_xml' provides a data bridge between hoptoad_notifier and Errbit.
  20 + ::Notice.from_xml(notice.to_xml)
  21 + logger.info "Internal error was logged to 'Self.Errbit' app."
  22 + rescue
  23 + logger.error "-- Errbit crashed while processing an internal error!" if logger
29 end 24 end
30 end 25 end
31 end 26 end
32 - alias_method_chain :send_notice, :internal  
33 end 27 end
34 end 28 end
35 29