class Raven::Configuration
Constants
- IGNORE_DEFAULT
Attributes
Exceptions from these directories to be ignored
Optional Proc to be used to send events asynchronously.
Optional Proc to be used to send events asynchronously.
Catch exceptions before they're been processed by ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions
Number of lines of code context to capture, or nil for none
Encoding type for event bodies
Whitelist of environments that will send notifications to Sentry
Which exceptions should never be sent
The Faraday adapter to be used. Will default to Net::HTTP when not set.
DEPRECATED: This option is now ignored as we use our own adapter.
Logger to use internally
Timeout waiting for the connection to open in seconds
Processors to run on data before sending upstream
Project ID number to send to the Sentry server
Project directory root
Proxy information to pass to the HTTP adapter
Public key for authentication with the Sentry server
Sanitize values that look like credit card numbers
additional fields to sanitize
Accessors for the component parts of the DSN
Secret key for authentication with the Sentry server
Include module versions in reports?
Simple server string (setter provided below)
Provide a configurable callback to determine event capture
Silence ready message
SSl settings passed direactly to faraday's ssl option
The path to the SSL certificate file
Should the SSL certificate of the server be verified?
Timeout when waiting for the server to return data in seconds
Public Class Methods
# File lib/raven/configuration.rb, line 114 def initialize self.server = ENV['SENTRY_DSN'] if ENV['SENTRY_DSN'] @context_lines = 3 self.current_environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'default' self.send_modules = true self.excluded_exceptions = IGNORE_DEFAULT self.processors = [Raven::Processor::RemoveCircularReferences, Raven::Processor::UTF8Conversion, Raven::Processor::SanitizeData] self.ssl_verification = true self.encoding = 'gzip' self.timeout = 1 self.open_timeout = 1 self.proxy = nil self.tags = {} self.async = false self.catch_debugged_exceptions = true self.sanitize_fields = [] self.sanitize_credit_cards = true self.environments = [] self.release = ENV['HEROKU_SLUG_COMMIT'] if self.release.nil? || self.release.empty? self.release = File.read(File.join(Rails.root, 'REVISION')).strip rescue nil end if self.release.nil? || self.release.empty? self.release = %x`git rev-parse --short HEAD`.strip rescue nil end end
Public Instance Methods
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/raven/configuration.rb, line 183 def [](option) send(option) end
# File lib/raven/configuration.rb, line 173 def async=(value) raise ArgumentError.new("async must be callable (or false to disable)") unless value == false || value.respond_to?(:call) @async = value end
# File lib/raven/configuration.rb, line 187 def current_environment=(environment) @current_environment = environment.to_s end
# File lib/raven/configuration.rb, line 166 def encoding=(encoding) raise Error.new('Unsupported encoding') unless %w(gzip json).include? encoding @encoding = encoding end
# File lib/raven/configuration.rb, line 195 def log_excluded_environment_message Raven.logger.debug "Event not sent due to excluded environment: #{current_environment}" end
# File lib/raven/configuration.rb, line 191 def send_in_current_environment? !!server && (environments.empty? || environments.include?(current_environment)) end
# File lib/raven/configuration.rb, line 144 def server=(value) uri = URI.parse(value) uri_path = uri.path.split('/') if uri.user # DSN-style string @project_id = uri_path.pop @public_key = uri.user @secret_key = uri.password end @scheme = uri.scheme @host = uri.host @port = uri.port if uri.port @path = uri_path.join('/') # For anyone who wants to read the base server string @server = "#{@scheme}://#{@host}" @server << ":#{@port}" unless @port == { 'http' => 80, 'https' => 443 }[@scheme] @server << @path end
# File lib/raven/configuration.rb, line 199 def verify! raise Error.new('No server specified') unless server raise Error.new('No public key specified') unless public_key raise Error.new('No secret key specified') unless secret_key raise Error.new('No project ID specified') unless project_id end