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.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/raygun/configuration.rb', line 122

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,
    api_url:                       'https://api.raygun.com/',
    breadcrumb_level:              :info,
    record_raw_data:               false,
    send_in_background:            false,
    error_report_send_timeout:     10
  )
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



120
121
122
# File 'lib/raygun/configuration.rb', line 120

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



146
147
148
# File 'lib/raygun/configuration.rb', line 146

def [](key)
  read_value(key)
end

#[]=(key, value) ⇒ Object



150
151
152
# File 'lib/raygun/configuration.rb', line 150

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

#affected_user_identifier_methodsObject



174
175
176
177
# File 'lib/raygun/configuration.rb', line 174

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_mapping)[:identifier]
end


162
163
164
# File 'lib/raygun/configuration.rb', line 162

def breadcrumb_level
  read_value(:breadcrumb_level)
end


166
167
168
169
170
171
172
# File 'lib/raygun/configuration.rb', line 166

def breadcrumb_level=(value)
  if Raygun::Breadcrumbs::BREADCRUMB_LEVELS.include?(value)
    set_value(:breadcrumb_level, value)
  elsif read_value(:debug)
    Raygun.log("[Raygun.configuration] unknown breadcrumb level: #{value} not setting")
  end
end

#silence_reportingObject



154
155
156
# File 'lib/raygun/configuration.rb', line 154

def silence_reporting
  !enable_reporting
end

#silence_reporting=(value) ⇒ Object



158
159
160
# File 'lib/raygun/configuration.rb', line 158

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