Class: Salemove::ProcessHandler::NotifierFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/salemove/process_handler/notifier_factory.rb

Class Method Summary collapse

Class Method Details

.get_notifier(process_name, conf) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/salemove/process_handler/notifier_factory.rb', line 9

def self.get_notifier(process_name, conf)
  if conf && conf[:type] == 'airbrake'
    Airbrake.configure do |airbrake|
      airbrake.async = true
      airbrake.environment_name = conf.fetch(:environment_name)
      airbrake.secure = true
      airbrake.host = conf.fetch(:host)
      airbrake.api_key = conf.fetch(:api_key)
      [/_HOST$/, /_TCP$/, /_UDP$/, /_PROTO$/, /_ADDR$/, 'PWD',
      'GEM_HOME', 'PATH', 'SERVICE_NAME', 'RUBY_MAJOR', 'RUBY_VERSION',
      'RUN_ENV', 'HOME', 'RUBYGEMS_VERSION', 'BUNDLER_VERSION'].each {
        | param_whitelist_filter| airbrake.params_whitelist_filters << param_whitelist_filter
      }
    end
    Airbrake
  elsif conf && conf[:type] == 'growl'
    GrowlNotifier.new(process_name)
  elsif conf && conf[:type] == 'terminal-notifier'
    TerminalNotifierWrapper.new(process_name)
  end
end