From a1bb9bd5d63f785243469718a17159b814d5e890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 16 Sep 2020 11:53:18 +0200 Subject: [PATCH] Fix Airbrake crash with no project key We were checking tho project_id but not the project_key. However, in our example secrets file we actually include a project_id but not a project_key, and so new CONSUL installations would crash in production environments. Although technically the application doesn't crash if no host is defined, we're also ignoring the current environment if no host is defined, since errbit/airbrake is unlikely to work in this scenario. --- config/initializers/errbit.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb index bb22b04ba..e9b2ccfbe 100644 --- a/config/initializers/errbit.rb +++ b/config/initializers/errbit.rb @@ -5,7 +5,10 @@ Airbrake.configure do |config| config.environment = Rails.env config.ignore_environments = %w[development test] - config.ignore_environments += [Rails.env] if Rails.application.secrets.errbit_project_id.blank? + + if config.host.blank? || config.project_id.blank? || config.project_key.blank? + config.ignore_environments += [Rails.env] + end end Airbrake.add_filter do |notice|