Class: Bugsnag::Configuration
- Inherits:
-
Object
- Object
- Bugsnag::Configuration
- Defined in:
- lib/bugsnag/configuration.rb
Constant Summary collapse
- THREAD_LOCAL_NAME =
"bugsnag_req_data"
- DEFAULT_ENDPOINT =
"notify.bugsnag.com"
- DEFAULT_PARAMS_FILTERS =
[ /authorization/i, /cookie/i, /password/i, /secret/i, "rack.request.form_vars" ].freeze
- DEFAULT_IGNORE_CLASSES =
[ "AbstractController::ActionNotFound", "ActionController::InvalidAuthenticityToken", "ActionController::ParameterMissing", "ActionController::RoutingError", "ActionController::UnknownAction", "ActionController::UnknownFormat", "ActionController::UnknownHttpMethod", "ActiveRecord::RecordNotFound", "CGI::Session::CookieStore::TamperedWithCookie", "Mongoid::Errors::DocumentNotFound", "SignalException", "SystemExit", ].freeze
- DEFAULT_IGNORE_USER_AGENTS =
[].freeze
- DEFAULT_DELIVERY_METHOD =
:thread_queue
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app_type ⇒ Object
Returns the value of attribute app_type.
-
#app_version ⇒ Object
Returns the value of attribute app_version.
-
#auto_notify ⇒ Object
Returns the value of attribute auto_notify.
-
#ca_file ⇒ Object
Returns the value of attribute ca_file.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#delay_with_resque ⇒ Object
Returns the value of attribute delay_with_resque.
-
#delivery_method ⇒ Object
Returns the value of attribute delivery_method.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#ignore_classes ⇒ Object
Accept both String and Class instances as an ignored class.
-
#ignore_user_agents ⇒ Object
Returns the value of attribute ignore_user_agents.
-
#internal_middleware ⇒ Object
Returns the value of attribute internal_middleware.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#notify_release_stages ⇒ Object
Returns the value of attribute notify_release_stages.
-
#params_filters ⇒ Object
Returns the value of attribute params_filters.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
-
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
-
#release_stage ⇒ Object
Returns the value of attribute release_stage.
-
#send_code ⇒ Object
Returns the value of attribute send_code.
-
#send_environment ⇒ Object
Returns the value of attribute send_environment.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#vendor_paths ⇒ Object
Returns the value of attribute vendor_paths.
Instance Method Summary collapse
- #clear_request_data ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #request_data ⇒ Object
- #set_request_data(key, value) ⇒ Object
- #should_notify? ⇒ Boolean
- #unset_request_data(key, value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/bugsnag/configuration.rb', line 68 def initialize @mutex = Mutex.new # Set up the defaults self.auto_notify = true self.use_ssl = true self.send_environment = false self.send_code = true self.params_filters = Set.new(DEFAULT_PARAMS_FILTERS) self.ignore_classes = Set.new(DEFAULT_IGNORE_CLASSES) self.ignore_user_agents = Set.new(DEFAULT_IGNORE_USER_AGENTS) self.endpoint = DEFAULT_ENDPOINT self.hostname = default_hostname self.delivery_method = DEFAULT_DELIVERY_METHOD self.timeout = 15 self.vendor_paths = [%r{vendor/}] # Read the API key from the environment self.api_key = ENV["BUGSNAG_API_KEY"] # Set up logging self.logger = Logger.new(STDOUT) self.logger.level = Logger::WARN # Configure the bugsnag middleware stack self.internal_middleware = Bugsnag::MiddlewareStack.new self.middleware = Bugsnag::MiddlewareStack.new self.middleware.use Bugsnag::Middleware::Callbacks end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/bugsnag/configuration.rb', line 8 def api_key @api_key end |
#app_type ⇒ Object
Returns the value of attribute app_type.
19 20 21 |
# File 'lib/bugsnag/configuration.rb', line 19 def app_type @app_type end |
#app_version ⇒ Object
Returns the value of attribute app_version.
18 19 20 |
# File 'lib/bugsnag/configuration.rb', line 18 def app_version @app_version end |
#auto_notify ⇒ Object
Returns the value of attribute auto_notify.
11 12 13 |
# File 'lib/bugsnag/configuration.rb', line 11 def auto_notify @auto_notify end |
#ca_file ⇒ Object
Returns the value of attribute ca_file.
13 14 15 |
# File 'lib/bugsnag/configuration.rb', line 13 def ca_file @ca_file end |
#debug ⇒ Object
Returns the value of attribute debug.
27 28 29 |
# File 'lib/bugsnag/configuration.rb', line 27 def debug @debug end |
#delay_with_resque ⇒ Object
Returns the value of attribute delay_with_resque.
26 27 28 |
# File 'lib/bugsnag/configuration.rb', line 26 def delay_with_resque @delay_with_resque end |
#delivery_method ⇒ Object
Returns the value of attribute delivery_method.
34 35 36 |
# File 'lib/bugsnag/configuration.rb', line 34 def delivery_method @delivery_method end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
22 23 24 |
# File 'lib/bugsnag/configuration.rb', line 22 def endpoint @endpoint end |
#hostname ⇒ Object
Returns the value of attribute hostname.
33 34 35 |
# File 'lib/bugsnag/configuration.rb', line 33 def hostname @hostname end |
#ignore_classes ⇒ Object
Accept both String and Class instances as an ignored class
100 101 102 |
# File 'lib/bugsnag/configuration.rb', line 100 def ignore_classes @mutex.synchronize { @ignore_classes.map! { |klass| klass.is_a?(Class) ? klass.name : klass } } end |
#ignore_user_agents ⇒ Object
Returns the value of attribute ignore_user_agents.
21 22 23 |
# File 'lib/bugsnag/configuration.rb', line 21 def ignore_user_agents @ignore_user_agents end |
#internal_middleware ⇒ Object
Returns the value of attribute internal_middleware.
25 26 27 |
# File 'lib/bugsnag/configuration.rb', line 25 def internal_middleware @internal_middleware end |
#logger ⇒ Object
Returns the value of attribute logger.
23 24 25 |
# File 'lib/bugsnag/configuration.rb', line 23 def logger @logger end |
#middleware ⇒ Object
Returns the value of attribute middleware.
24 25 26 |
# File 'lib/bugsnag/configuration.rb', line 24 def middleware @middleware end |
#notify_release_stages ⇒ Object
Returns the value of attribute notify_release_stages.
10 11 12 |
# File 'lib/bugsnag/configuration.rb', line 10 def notify_release_stages @notify_release_stages end |
#params_filters ⇒ Object
Returns the value of attribute params_filters.
20 21 22 |
# File 'lib/bugsnag/configuration.rb', line 20 def params_filters @params_filters end |
#project_root ⇒ Object
Returns the value of attribute project_root.
16 17 18 |
# File 'lib/bugsnag/configuration.rb', line 16 def project_root @project_root end |
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
28 29 30 |
# File 'lib/bugsnag/configuration.rb', line 28 def proxy_host @proxy_host end |
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
31 32 33 |
# File 'lib/bugsnag/configuration.rb', line 31 def proxy_password @proxy_password end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
29 30 31 |
# File 'lib/bugsnag/configuration.rb', line 29 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
30 31 32 |
# File 'lib/bugsnag/configuration.rb', line 30 def proxy_user @proxy_user end |
#release_stage ⇒ Object
Returns the value of attribute release_stage.
9 10 11 |
# File 'lib/bugsnag/configuration.rb', line 9 def release_stage @release_stage end |
#send_code ⇒ Object
Returns the value of attribute send_code.
15 16 17 |
# File 'lib/bugsnag/configuration.rb', line 15 def send_code @send_code end |
#send_environment ⇒ Object
Returns the value of attribute send_environment.
14 15 16 |
# File 'lib/bugsnag/configuration.rb', line 14 def send_environment @send_environment end |
#timeout ⇒ Object
Returns the value of attribute timeout.
32 33 34 |
# File 'lib/bugsnag/configuration.rb', line 32 def timeout @timeout end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
12 13 14 |
# File 'lib/bugsnag/configuration.rb', line 12 def use_ssl @use_ssl end |
#vendor_paths ⇒ Object
Returns the value of attribute vendor_paths.
17 18 19 |
# File 'lib/bugsnag/configuration.rb', line 17 def vendor_paths @vendor_paths end |
Instance Method Details
#clear_request_data ⇒ Object
120 121 122 |
# File 'lib/bugsnag/configuration.rb', line 120 def clear_request_data Thread.current[THREAD_LOCAL_NAME] = nil end |
#request_data ⇒ Object
108 109 110 |
# File 'lib/bugsnag/configuration.rb', line 108 def request_data Thread.current[THREAD_LOCAL_NAME] ||= {} end |
#set_request_data(key, value) ⇒ Object
112 113 114 |
# File 'lib/bugsnag/configuration.rb', line 112 def set_request_data(key, value) self.request_data[key] = value end |
#should_notify? ⇒ Boolean
104 105 106 |
# File 'lib/bugsnag/configuration.rb', line 104 def should_notify? @release_stage.nil? || @notify_release_stages.nil? || @notify_release_stages.include?(@release_stage) end |
#unset_request_data(key, value) ⇒ Object
116 117 118 |
# File 'lib/bugsnag/configuration.rb', line 116 def unset_request_data(key, value) self.request_data.delete(key) end |