Class: DefraRuby::Alert::AirbrakeRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/defra_ruby/alert/airbrake_runner.rb

Class Method Summary collapse

Class Method Details

.invokeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/defra_ruby/alert/airbrake_runner.rb', line 9

def self.invoke
  configure

  return if DefraRuby::Alert.configuration.enabled

  # Unfortunately the airbrake initializer errors if project_key is not set. The
  # problem is that the initializer is fired in scenarios where we are not
  # actually using the app, for example when running a rake task.
  #
  # In production when we run rake tasks it's in an environment where environment
  # variables have not been set. As such we need a way to disable using Airbrake
  # unless we actually need it.
  Airbrake.add_filter(&:ignore!)
end