Class: Raven::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/raven/configuration.rb

Constant Summary collapse

IGNORE_DEFAULT =
['ActiveRecord::RecordNotFound',
'ActionController::RoutingError',
'ActionController::InvalidAuthenticityToken',
'CGI::Session::CookieStore::TamperedWithCookie',
'ActionController::UnknownAction',
'AbstractController::ActionNotFound',
'Mongoid::Errors::DocumentNotFound']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



53
54
55
56
57
58
59
60
61
62
# File 'lib/raven/configuration.rb', line 53

def initialize
  self.server = ENV['SENTRY_DSN'] if ENV['SENTRY_DSN']
  @context_lines = 3
  self.environments = %w[ production ]
  self.current_environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
  self.send_modules = true
  self.excluded_exceptions = IGNORE_DEFAULT
  self.processors = [Raven::Processor::SanitizeData]
  self.ssl_verification = true
end

Instance Attribute Details

#context_linesObject

Number of lines of code context to capture, or nil for none



20
21
22
# File 'lib/raven/configuration.rb', line 20

def context_lines
  @context_lines
end

#current_environmentObject

Returns the value of attribute current_environment.



43
44
45
# File 'lib/raven/configuration.rb', line 43

def current_environment
  @current_environment
end

#environmentsObject

Whitelist of environments that will send notifications to Sentry



23
24
25
# File 'lib/raven/configuration.rb', line 23

def environments
  @environments
end

#excluded_exceptionsObject

Which exceptions should never be sent



29
30
31
# File 'lib/raven/configuration.rb', line 29

def excluded_exceptions
  @excluded_exceptions
end

#loggerObject

Logger to use internally



17
18
19
# File 'lib/raven/configuration.rb', line 17

def logger
  @logger
end

#open_timeoutObject

Timeout waiting for the connection to open in seconds



38
39
40
# File 'lib/raven/configuration.rb', line 38

def open_timeout
  @open_timeout
end

#processorsObject

Processors to run on data before sending upstream



32
33
34
# File 'lib/raven/configuration.rb', line 32

def processors
  @processors
end

#project_idObject

Project ID number to send to the Sentry server



14
15
16
# File 'lib/raven/configuration.rb', line 14

def project_id
  @project_id
end

#public_keyObject

Public key for authentication with the Sentry server



8
9
10
# File 'lib/raven/configuration.rb', line 8

def public_key
  @public_key
end

#secret_keyObject

Secret key for authentication with the Sentry server



11
12
13
# File 'lib/raven/configuration.rb', line 11

def secret_key
  @secret_key
end

#send_modulesObject

Include module versions in reports?



26
27
28
# File 'lib/raven/configuration.rb', line 26

def send_modules
  @send_modules
end

#serverObject

Base URL of the Sentry server



5
6
7
# File 'lib/raven/configuration.rb', line 5

def server
  @server
end

#ssl_verificationObject

Should the SSL certificate of the server be verified?



41
42
43
# File 'lib/raven/configuration.rb', line 41

def ssl_verification
  @ssl_verification
end

#timeoutObject

Timeout when waiting for the server to return data in seconds



35
36
37
# File 'lib/raven/configuration.rb', line 35

def timeout
  @timeout
end

Instance Method Details

#[](option) ⇒ Object

Allows config options to be read like a hash

Parameters:

  • option (Symbol)

    Key for a given attribute



85
86
87
# File 'lib/raven/configuration.rb', line 85

def [](option)
  send(option)
end

#send_in_current_environment?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/raven/configuration.rb', line 93

def send_in_current_environment?
  environments.include? current_environment
end