class Opbeat::Configuration

Attributes

app_id[RW]

App ID to use with Opbeat

async[R]

Optional Proc to be used to send events asynchronously

async?[R]

Optional Proc to be used to send events asynchronously

backoff_multiplier[RW]

Backoff multipler

context_lines[RW]

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

current_environment[R]
environments[RW]

Whitelist of environments that will send notifications to Opbeat

excluded_exceptions[RW]

Which exceptions should never be sent

filter_parameters[RW]

An array of parameters whould should be filtered from the log

logger[RW]

Logger to use internally

open_timeout[RW]

Timout when opening connection to the server

organization_id[RW]

Organization ID to use with Opbeat

secret_token[RW]

Secret access token for authentication with Opbeat

server[RW]

Base URL of the Opbeat server

ssl_verification[RW]

Should the SSL certificate of the server be verified?

timeout[RW]

Timeout when waiting for the server to return data in seconds

user_controller_method[RW]

Public Class Methods

new() click to toggle source
# File lib/opbeat/configuration.rb, line 50
def initialize
  self.server = ENV['OPBEAT_SERVER'] || "https://intake.opbeat.com"
  self.secret_token = ENV['OPBEAT_SECRET_TOKEN'] if ENV['OPBEAT_SECRET_TOKEN']
  self.organization_id = ENV['OPBEAT_ORGANIZATION_ID'] if ENV['OPBEAT_ORGANIZATION_ID']
  self.app_id = ENV['OPBEAT_APP_ID'] if ENV['OPBEAT_APP_ID']
  @context_lines = 3
  self.environments = %w[ development production default ]
  self.current_environment = (defined?(::Rails) && ::Rails.env) || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'default'
  self.excluded_exceptions = []
  self.timeout = 1
  self.open_timeout = 1
  self.backoff_multiplier = 2
  self.ssl_verification = true
  self.user_controller_method = 'current_user'
  self.async = false
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/opbeat/configuration.rb, line 70
def [](option)
  send(option)
end
async=(value) click to toggle source
# File lib/opbeat/configuration.rb, line 82
def async=(value)
  raise ArgumentError.new("async must be callable (or false to disable)") unless (value == false || value.respond_to?(:call))
  @async = value
end
current_environment=(environment) click to toggle source
# File lib/opbeat/configuration.rb, line 74
def current_environment=(environment)
  @current_environment = environment.to_s
end
send_in_current_environment?() click to toggle source
# File lib/opbeat/configuration.rb, line 78
def send_in_current_environment?
  environments.include? current_environment
end