Class: Batbugger::Configuration
- Inherits:
-
Object
- Object
- Batbugger::Configuration
- Defined in:
- lib/batbugger/configuration.rb
Constant Summary collapse
- OPTIONS =
[:api_key, :backtrace_filters, :development_environments, :environment_name, :host, :http_open_timeout, :http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent, :notifier_name, :notifier_url, :notifier_version, :params_filters, :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port, :proxy_user, :secure, :use_system_ssl_cert_chain, :framework, :user_information, :rescue_rake_exceptions, :source_extract_radius, :send_request_session, :debug].freeze
- DEFAULT_PARAMS_FILTERS =
%w(password password_confirmation).freeze
- DEFAULT_BACKTRACE_FILTERS =
[ lambda { |line| if defined?(Batbugger.configuration.project_root) && Batbugger.configuration.project_root.to_s != '' line.sub(/#{Batbugger.configuration.project_root}/, "[PROJECT_ROOT]") else line end }, lambda { |line| line.gsub(/^\.\//, "") }, lambda { |line| if defined?(Gem) Gem.path.inject(line) do |line, path| line.gsub(/#{path}/, "[GEM_ROOT]") end end }, lambda { |line| line if line !~ %r{lib/batbugger} } ].freeze
- IGNORE_DEFAULT =
['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', 'Mongoid::Errors::DocumentNotFound']
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
- #async ⇒ Object (also: #async?)
-
#backtrace_filters ⇒ Object
readonly
Returns the value of attribute backtrace_filters.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#development_environments ⇒ Object
Returns the value of attribute development_environments.
-
#environment_name ⇒ Object
Returns the value of attribute environment_name.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
-
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
#ignore ⇒ Object
readonly
Returns the value of attribute ignore.
-
#ignore_by_filters ⇒ Object
readonly
Returns the value of attribute ignore_by_filters.
-
#ignore_user_agent ⇒ Object
readonly
Returns the value of attribute ignore_user_agent.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#notifier_name ⇒ Object
Returns the value of attribute notifier_name.
-
#notifier_url ⇒ Object
Returns the value of attribute notifier_url.
-
#notifier_version ⇒ Object
Returns the value of attribute notifier_version.
-
#params_filters ⇒ Object
readonly
Returns the value of attribute params_filters.
-
#port ⇒ Object
Returns the value of attribute port.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
-
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
-
#rescue_rake_exceptions ⇒ Object
Returns the value of attribute rescue_rake_exceptions.
-
#secure ⇒ Object
(also: #secure?)
Returns the value of attribute secure.
-
#send_request_session ⇒ Object
Returns the value of attribute send_request_session.
-
#source_extract_radius ⇒ Object
Returns the value of attribute source_extract_radius.
-
#use_system_ssl_cert_chain ⇒ Object
(also: #use_system_ssl_cert_chain?)
Returns the value of attribute use_system_ssl_cert_chain.
-
#user_information ⇒ Object
Returns the value of attribute user_information.
Instance Method Summary collapse
- #[](option) ⇒ Object
- #ca_bundle_path ⇒ Object
- #current_user_method=(null) ⇒ Object
- #filter_backtrace(&block) ⇒ Object
- #ignore_by_filter(&block) ⇒ Object
- #ignore_only=(names) ⇒ Object
- #ignore_user_agent_only=(names) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #local_cert_path ⇒ Object
- #merge(hash) ⇒ Object
- #protocol ⇒ Object
- #public? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/batbugger/configuration.rb', line 103 def initialize @secure = true @use_system_ssl_cert_chain = false @host = 'www.batbugger.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 = %w(development test cucumber) @notifier_name = 'Batbugger Notifier' @notifier_version = VERSION @notifier_url = 'https://github.com/grepruby/batbugger' @framework = 'Standalone' @user_information = 'Batbugger Error {{error_id}}' @rescue_rake_exceptions = nil @source_extract_radius = 2 @send_request_session = true @debug = false end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/batbugger/configuration.rb', line 11 def api_key @api_key end |
#async ⇒ Object Also known as: async?
161 162 163 164 |
# File 'lib/batbugger/configuration.rb', line 161 def async @async = Proc.new if block_given? @async end |
#backtrace_filters ⇒ Object (readonly)
Returns the value of attribute backtrace_filters.
35 36 37 |
# File 'lib/batbugger/configuration.rb', line 35 def backtrace_filters @backtrace_filters end |
#debug ⇒ Object
Returns the value of attribute debug.
67 68 69 |
# File 'lib/batbugger/configuration.rb', line 67 def debug @debug end |
#development_environments ⇒ Object
Returns the value of attribute development_environments.
43 44 45 |
# File 'lib/batbugger/configuration.rb', line 43 def development_environments @development_environments end |
#environment_name ⇒ Object
Returns the value of attribute environment_name.
45 46 47 |
# File 'lib/batbugger/configuration.rb', line 45 def environment_name @environment_name end |
#framework ⇒ Object
Returns the value of attribute framework.
59 60 61 |
# File 'lib/batbugger/configuration.rb', line 59 def framework @framework end |
#host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/batbugger/configuration.rb', line 13 def host @host end |
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
21 22 23 |
# File 'lib/batbugger/configuration.rb', line 21 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
23 24 25 |
# File 'lib/batbugger/configuration.rb', line 23 def http_read_timeout @http_read_timeout end |
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
39 40 41 |
# File 'lib/batbugger/configuration.rb', line 39 def ignore @ignore end |
#ignore_by_filters ⇒ Object (readonly)
Returns the value of attribute ignore_by_filters.
37 38 39 |
# File 'lib/batbugger/configuration.rb', line 37 def ignore_by_filters @ignore_by_filters end |
#ignore_user_agent ⇒ Object (readonly)
Returns the value of attribute ignore_user_agent.
41 42 43 |
# File 'lib/batbugger/configuration.rb', line 41 def ignore_user_agent @ignore_user_agent end |
#logger ⇒ Object
Returns the value of attribute logger.
55 56 57 |
# File 'lib/batbugger/configuration.rb', line 55 def logger @logger end |
#notifier_name ⇒ Object
Returns the value of attribute notifier_name.
49 50 51 |
# File 'lib/batbugger/configuration.rb', line 49 def notifier_name @notifier_name end |
#notifier_url ⇒ Object
Returns the value of attribute notifier_url.
53 54 55 |
# File 'lib/batbugger/configuration.rb', line 53 def notifier_url @notifier_url end |
#notifier_version ⇒ Object
Returns the value of attribute notifier_version.
51 52 53 |
# File 'lib/batbugger/configuration.rb', line 51 def notifier_version @notifier_version end |
#params_filters ⇒ Object (readonly)
Returns the value of attribute params_filters.
33 34 35 |
# File 'lib/batbugger/configuration.rb', line 33 def params_filters @params_filters end |
#port ⇒ Object
Returns the value of attribute port.
15 16 17 |
# File 'lib/batbugger/configuration.rb', line 15 def port @port end |
#project_root ⇒ Object
Returns the value of attribute project_root.
47 48 49 |
# File 'lib/batbugger/configuration.rb', line 47 def project_root @project_root end |
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
25 26 27 |
# File 'lib/batbugger/configuration.rb', line 25 def proxy_host @proxy_host end |
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
31 32 33 |
# File 'lib/batbugger/configuration.rb', line 31 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
27 28 29 |
# File 'lib/batbugger/configuration.rb', line 27 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
29 30 31 |
# File 'lib/batbugger/configuration.rb', line 29 def proxy_user @proxy_user end |
#rescue_rake_exceptions ⇒ Object
Returns the value of attribute rescue_rake_exceptions.
61 62 63 |
# File 'lib/batbugger/configuration.rb', line 61 def rescue_rake_exceptions @rescue_rake_exceptions end |
#secure ⇒ Object Also known as: secure?
Returns the value of attribute secure.
17 18 19 |
# File 'lib/batbugger/configuration.rb', line 17 def secure @secure end |
#send_request_session ⇒ Object
Returns the value of attribute send_request_session.
65 66 67 |
# File 'lib/batbugger/configuration.rb', line 65 def send_request_session @send_request_session end |
#source_extract_radius ⇒ Object
Returns the value of attribute source_extract_radius.
63 64 65 |
# File 'lib/batbugger/configuration.rb', line 63 def source_extract_radius @source_extract_radius end |
#use_system_ssl_cert_chain ⇒ Object Also known as: use_system_ssl_cert_chain?
Returns the value of attribute use_system_ssl_cert_chain.
19 20 21 |
# File 'lib/batbugger/configuration.rb', line 19 def use_system_ssl_cert_chain @use_system_ssl_cert_chain end |
#user_information ⇒ Object
Returns the value of attribute user_information.
57 58 59 |
# File 'lib/batbugger/configuration.rb', line 57 def user_information @user_information end |
Instance Method Details
#[](option) ⇒ Object
142 143 144 |
# File 'lib/batbugger/configuration.rb', line 142 def [](option) send(option) end |
#ca_bundle_path ⇒ Object
179 180 181 182 183 184 185 |
# File 'lib/batbugger/configuration.rb', line 179 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 end end |
#current_user_method=(null) ⇒ Object
191 |
# File 'lib/batbugger/configuration.rb', line 191 def current_user_method=(null) ; end |
#filter_backtrace(&block) ⇒ Object
126 127 128 |
# File 'lib/batbugger/configuration.rb', line 126 def filter_backtrace(&block) self.backtrace_filters << block end |
#ignore_by_filter(&block) ⇒ Object
130 131 132 |
# File 'lib/batbugger/configuration.rb', line 130 def ignore_by_filter(&block) self.ignore_by_filters << block end |
#ignore_only=(names) ⇒ Object
134 135 136 |
# File 'lib/batbugger/configuration.rb', line 134 def ignore_only=(names) @ignore = [names].flatten end |
#ignore_user_agent_only=(names) ⇒ Object
138 139 140 |
# File 'lib/batbugger/configuration.rb', line 138 def ignore_user_agent_only=(names) @ignore_user_agent = [names].flatten end |
#local_cert_path ⇒ Object
187 188 189 |
# File 'lib/batbugger/configuration.rb', line 187 def local_cert_path File.(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__) end |
#merge(hash) ⇒ Object
153 154 155 |
# File 'lib/batbugger/configuration.rb', line 153 def merge(hash) to_hash.merge(hash) end |
#protocol ⇒ Object
171 172 173 174 175 176 177 |
# File 'lib/batbugger/configuration.rb', line 171 def protocol if secure? 'https' else 'http' end end |
#public? ⇒ Boolean
157 158 159 |
# File 'lib/batbugger/configuration.rb', line 157 def public? !development_environments.include?(environment_name) end |
#to_hash ⇒ Object
146 147 148 149 150 151 |
# File 'lib/batbugger/configuration.rb', line 146 def to_hash OPTIONS.inject({}) do |hash, option| hash[option.to_sym] = self.send(option) hash end end |