Class: Raygun::Configuration

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

Constant Summary collapse

IGNORE_DEFAULT =

Exception classes to ignore by default

['ActiveRecord::RecordNotFound',
'ActionController::RoutingError',
'ActionController::InvalidAuthenticityToken',
'ActionDispatch::ParamsParser::ParseError',
'CGI::Session::CookieStore::TamperedWithCookie',
'ActionController::UnknownAction',
'AbstractController::ActionNotFound',
'Mongoid::Errors::DocumentNotFound']
DEFAULT_FILTER_PARAMETERS =
[ :password, :card_number, :cvv ]
DEFAULT_WHITELIST_PAYLOAD_SHAPE_REQUEST =
{
  hostName: true,
  url: true,
  httpMethod: true,
  iPAddress: true,
  queryString: true,
  headers: true,
  form: {}, # Set to empty hash so that it doesn't just filter out the whole thing, but instead filters out each individual param
  rawData: true
}.freeze
DEFAULT_WHITELIST_PAYLOAD_SHAPE =
{
  machineName: true,
  version: true,
  error: true,
  userCustomData: true,
  tags: true,
  request: DEFAULT_WHITELIST_PAYLOAD_SHAPE_REQUEST
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/raygun/configuration.rb', line 103

def initialize
  @config_values = {}

  # set default attribute values
  @defaults = OpenStruct.new({
    ignore:                           IGNORE_DEFAULT,
    custom_data:                      {},
    tags:                             [],
    enable_reporting:                 true,
    affected_user_method:             :current_user,
    affected_user_mapping:            AffectedUser::DEFAULT_MAPPING,
    filter_parameters:                DEFAULT_FILTER_PARAMETERS,
    filter_payload_with_whitelist:    false,
    whitelist_payload_shape:          DEFAULT_WHITELIST_PAYLOAD_SHAPE,
    proxy_settings:                   {},
    debug: false
  })
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



101
102
103
# File 'lib/raygun/configuration.rb', line 101

def defaults
  @defaults
end

Class Method Details

.config_option(name) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/raygun/configuration.rb', line 4

def self.config_option(name)
  define_method(name) do
    read_value(name)
  end

  define_method("#{name}=") do |value|
    set_value(name, value)
  end
end

.proc_config_option(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/raygun/configuration.rb', line 14

def self.proc_config_option(name)
  define_method(name) do |&block|
    set_value(name, block) unless block == nil
    read_value(name)
  end

  define_method("#{name}=") do |value|
    set_value(name, value)
  end
end

Instance Method Details

#[](key) ⇒ Object



122
123
124
# File 'lib/raygun/configuration.rb', line 122

def [](key)
  read_value(key)
end

#[]=(key, value) ⇒ Object



126
127
128
# File 'lib/raygun/configuration.rb', line 126

def []=(key, value)
  set_value(key, value)
end

#affected_user_identifier_methodsObject



138
139
140
141
# File 'lib/raygun/configuration.rb', line 138

def affected_user_identifier_methods
  Raygun.deprecation_warning("Please note: You should now user config.affected_user_method_mapping.Identifier instead of config.affected_user_identifier_methods")
  read_value(:affected_user_method_mapping).Identifier
end

#silence_reportingObject



130
131
132
# File 'lib/raygun/configuration.rb', line 130

def silence_reporting
  !enable_reporting
end

#silence_reporting=(value) ⇒ Object



134
135
136
# File 'lib/raygun/configuration.rb', line 134

def silence_reporting=(value)
  self.enable_reporting = !value
end