Commit 10dcc7f05ae7badab8110c7b033570f797994ab8

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

Added error handling for Errbit itself. Errors are sent to a centralized instanc…

…e by default, but this can be changed in config.yml [ci skip]
config/config.example.yml
... ... @@ -31,3 +31,13 @@ confirm_resolve_err: true
31 31 # Helpful if you want to plug in your own authentication strategy.
32 32 user_has_username: false
33 33  
  34 +# Configure tracking for Errbit's own internal errors.
  35 +# There is a central Errbit instance running on heroku,
  36 +# and other Errbit instances will send their errors there by default.
  37 +# Please leave this section commented unless you really need to change it.
  38 +# ------------------------------------------------------------------------
  39 +# report_self_errors: true
  40 +# self_errors_host: errbit-central.heroku.com
  41 +# self_errors_port: 80
  42 +# self_errors_api_key: 11e5ce322856e540481e6a0789893179
  43 +
... ...
config/initializers/_load_config.rb
... ... @@ -6,6 +6,12 @@ if ENV['HEROKU']
6 6 Errbit::Config.host = ENV['ERRBIT_HOST']
7 7 Errbit::Config.email_from = ENV['ERRBIT_EMAIL_FROM']
8 8 Errbit::Config.email_at_notices = [1,3,10] #ENV['ERRBIT_EMAIL_AT_NOTICES']
  9 +
  10 + Errbit::Config.report_self_errors = ENV['ERRBIT_REPORT_SELF_ERRORS']
  11 + Errbit::Config.self_errors_host = ENV['ERRBIT_SELF_ERRORS_HOST']
  12 + Errbit::Config.self_errors_port = ENV['ERRBIT_SELF_ERRORS_PORT']
  13 + Errbit::Config.self_errors_api_key = ENV['ERRBIT_SELF_ERRORS_API_KEY']
  14 +
9 15 Errbit::Application.config.action_mailer.smtp_settings = {
10 16 :address => "smtp.sendgrid.net",
11 17 :port => "25",
... ...
config/initializers/hoptoad.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +if Rails.env.production? && Errbit::Config.report_self_errors.to_s != "false"
  2 + HoptoadNotifier.configure do |config|
  3 + config.api_key = Errbit::Config.api_key || "11e5ce322856e540481e6a0789893179"
  4 + config.host = Errbit::Config.host || "errbit-central.heroku.com"
  5 + config.port = Errbit::Config.port || 80
  6 + config.secure = config.port == 443
  7 + end
  8 +end
  9 +
... ...