Parent

Airbrake::Configuration

Used to set up and modify settings for the notifier.

Attributes

api_key[RW]

The API key for your project, found on the project edit form.

backtrace_filters[R]

A list of filters for cleaning and pruning the backtrace. See filter_backtrace.

development_environments[RW]

A list of environments in which notifications should not be sent.

development_lookup[RW]

true if you want to check for production errors matching development errors, false otherwise.

environment_name[RW]

The name of the environment the application is running in

framework[RW]

The framework Airbrake is configured to use

host[RW]

The host to connect to (defaults to airbrake.io).

http_open_timeout[RW]

The HTTP open timeout in seconds (defaults to 2).

http_read_timeout[RW]

The HTTP read timeout in seconds (defaults to 5).

ignore[R]

A list of exception classes to ignore. The array can be appended to.

ignore_by_filters[R]

A list of filters for ignoring exceptions. See ignore_by_filter.

ignore_user_agent[R]

A list of user agents that are being ignored. The array can be appended to.

js_api_key[W]

If you're using the Javascript notifier and would want to separate Javascript notifications into another Airbrake project, specify its APi key here. Defaults to api_key (of the base project)

logger[RW]

The logger used by Airbrake

notifier_name[RW]

The name of the notifier library being used to send notifications (such as "Airbrake Notifier")

notifier_url[RW]

The url of the notifier library being used to send notifications

notifier_version[RW]

The version of the notifier library being used to send notifications (such as "1.0.2")

params_filters[R]

A list of parameters that should be filtered out of what is sent to Airbrake. By default, all "password" attributes will have their contents replaced.

port[RW]

The port on which your Airbrake server runs (defaults to 443 for secure connections, 80 for insecure connections).

project_root[RW]

The path to the project in which the error occurred, such as the Rails.root

proxy_host[RW]

The hostname of your proxy server (if using a proxy)

proxy_pass[RW]

The password to use when logging into your proxy server (if using a proxy)

proxy_port[RW]

The port of your proxy server (if using a proxy)

proxy_user[RW]

The username to use when logging into your proxy server (if using a proxy)

rake_environment_filters[R]

A list of environment keys that will be ignored from what is sent to Airbrake server Empty by default and used only in rake handler

rescue_rake_exceptions[RW]

Should Airbrake catch exceptions from Rake tasks? (boolean or nil; set to nil to catch exceptions when rake isn't running from a terminal; default is nil)

secure[RW]

true for https connections, false for http connections.

secure?[RW]

true for https connections, false for http connections.

use_system_ssl_cert_chain[RW]

true to use whatever CAs OpenSSL has installed on your system. false to use the ca-bundle.crt file included in Airbrake itself (reccomended and default)

use_system_ssl_cert_chain?[RW]

true to use whatever CAs OpenSSL has installed on your system. false to use the ca-bundle.crt file included in Airbrake itself (reccomended and default)

user_attributes[RW]

User attributes that are being captured

user_information[RW]

The text that the placeholder is replaced with. {{error_id}} is the actual error number.

Public Class Methods

new() click to toggle source
# File lib/airbrake/configuration.rb, line 145
def initialize
  @secure                   = false
  @use_system_ssl_cert_chain= false
  @host                     = 'api.airbrake.io'
  @http_open_timeout        = 2
  @http_read_timeout        = 5
  @params_filters           = DEFAULT_PARAMS_FILTERS.dup
  @backtrace_filters        = DEFAULT_BACKTRACE_FILTERS.dup
  @ignore_by_filters        = []
  @ignore                   = IGNORE_DEFAULT.dup
  @ignore_user_agent        = []
  @development_environments = %(development test cucumber)
  @development_lookup       = true
  @notifier_name            = 'Airbrake Notifier'
  @notifier_version         = VERSION
  @notifier_url             = 'https://github.com/airbrake/airbrake'
  @framework                = 'Standalone'
  @user_information         = 'Airbrake Error {{error_id}}'
  @rescue_rake_exceptions   = nil
  @user_attributes          = DEFAULT_USER_ATTRIBUTES.dup
  @rake_environment_filters = []
end

Public Instance Methods

[](option) click to toggle source

Allows config options to be read like a hash

@param [Symbol] option Key for a given attribute

# File lib/airbrake/configuration.rb, line 214
def [](option)
  send(option)
end
async(&block) click to toggle source

Should Airbrake send notifications asynchronously (boolean, nil or callable; default is nil). Can be used as callable-setter when block provided.

# File lib/airbrake/configuration.rb, line 257
def async(&block)
  if block_given?
    @async = block
  end
  @async
end
Also aliased as: async?
async=(use_default_or_this) click to toggle source
# File lib/airbrake/configuration.rb, line 265
def async=(use_default_or_this)
  @async = use_default_or_this == true ?
    default_async_processor :
    use_default_or_this
end
async?(&block) click to toggle source
Alias for: async
ca_bundle_path() click to toggle source
# File lib/airbrake/configuration.rb, line 279
def ca_bundle_path
  if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
    OpenSSL::X509::DEFAULT_CERT_FILE
  else
    local_cert_path # ca-bundle.crt built from source, see resources/README.md
  end
end
filter_backtrace(&block) click to toggle source

Takes a block and adds it to the list of backtrace filters. When the filters run, the block will be handed each line of the backtrace and can modify it as necessary.

@example

config.filter_bracktrace do |line|
  line.gsub(/^#{Rails.root}/, "[Rails.root]")
end

@param [Proc] block The new backtrace filter. @yieldparam [String] line A line in the backtrace.

# File lib/airbrake/configuration.rb, line 179
def filter_backtrace(&block)
  self.backtrace_filters << block
end
ignore_by_filter(&block) click to toggle source

Takes a block and adds it to the list of ignore filters. When the filters run, the block will be handed the exception. @example

config.ignore_by_filter do |exception_data|
  true if exception_data[:error_class] == "RuntimeError"
end

@param [Proc] block The new ignore filter @yieldparam [Hash] data The exception data given to Airbrake.notify @yieldreturn [Boolean] If the block returns true the exception will be ignored, otherwise it will be processed by airbrake.

# File lib/airbrake/configuration.rb, line 193
def ignore_by_filter(&block)
  self.ignore_by_filters << block
end
ignore_only=(names) click to toggle source

Overrides the list of default ignored errors.

@param [Array<Exception>] names A list of exceptions to ignore.

# File lib/airbrake/configuration.rb, line 200
def ignore_only=(names)
  @ignore = [names].flatten
end
ignore_user_agent_only=(names) click to toggle source

Overrides the list of default ignored user agents

@param [Array<String>] A list of user agents to ignore

# File lib/airbrake/configuration.rb, line 207
def ignore_user_agent_only=(names)
  @ignore_user_agent = [names].flatten
end
js_api_key() click to toggle source
# File lib/airbrake/configuration.rb, line 271
def js_api_key
  @js_api_key || self.api_key
end
js_notifier=(*args) click to toggle source
# File lib/airbrake/configuration.rb, line 275
def js_notifier=(*args)
  warn '[AIRBRAKE] config.js_notifier has been deprecated and has no effect.  You should use <%= airbrake_javascript_notifier %> directly at the top of your layouts.  Be sure to place it before all other javascript.'
end
local_cert_path() click to toggle source
# File lib/airbrake/configuration.rb, line 287
def local_cert_path
  File.expand_path(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__)
end
merge(hash) click to toggle source

Returns a hash of all configurable options merged with hash

@param [Hash] hash A set of configuration options that will take precedence over the defaults

# File lib/airbrake/configuration.rb, line 229
def merge(hash)
  to_hash.merge(hash)
end
protocol() click to toggle source

Determines whether protocol should be "http" or "https". @return [String] Returns +"http"+ if you've set secure to false in configuration, and +"https"+ otherwise.

# File lib/airbrake/configuration.rb, line 246
def protocol
  if secure?
    'https'
  else
    'http'
  end
end
public?() click to toggle source

Determines if the notifier will send notices. @return [Boolean] Returns false if in a development environment, true otherwise.

# File lib/airbrake/configuration.rb, line 235
def public?
  !development_environments.include?(environment_name)
end
to_hash() click to toggle source

Returns a hash of all configurable options

# File lib/airbrake/configuration.rb, line 219
def to_hash
  OPTIONS.inject({}) do |hash, option|
    hash[option.to_sym] = self.send(option)
    hash
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.