Class: ErrorappNotifier::Config
- Inherits:
-
Object
- Object
- ErrorappNotifier::Config
- Defined in:
- lib/errorapp_notifier/config.rb
Constant Summary collapse
- DEFAULT_IGNORE_EXCEPTIONS =
['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', 'ActionController::UnknownFormat', 'Mongoid::Errors::DocumentNotFound', 'Sinatra::NotFound', "SystemExit", "SignalException"].freeze
- DEFAULT_PARAMS_FILTERS =
%w(password password_confirmation).freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#disabled_by_default ⇒ Object
Returns the value of attribute disabled_by_default.
-
#environment_name ⇒ Object
Returns the value of attribute environment_name.
-
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
-
#http_proxy_host ⇒ Object
Returns the value of attribute http_proxy_host.
-
#http_proxy_password ⇒ Object
Returns the value of attribute http_proxy_password.
-
#http_proxy_port ⇒ Object
Returns the value of attribute http_proxy_port.
-
#http_proxy_username ⇒ Object
Returns the value of attribute http_proxy_username.
-
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
#ignore_exceptions ⇒ Object
Returns the value of attribute ignore_exceptions.
-
#ignore_user_agents ⇒ Object
Returns the value of attribute ignore_user_agents.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#params_filters ⇒ Object
Returns the value of attribute params_filters.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#remote_host ⇒ Object
Returns the value of attribute remote_host.
-
#remote_port ⇒ Object
Returns the value of attribute remote_port.
-
#ssl ⇒ Object
(also: #ssl?)
Returns the value of attribute ssl.
Instance Method Summary collapse
- #application_environment ⇒ Object
- #application_root ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #should_send_to_api? ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/errorapp_notifier/config.rb', line 37 def initialize @api_key = ENV['ERRORAPP_API_KEY'] @disabled_by_default = %w(development test) @http_open_timeout = 2 @http_read_timeout = 4 @ignore_exceptions = DEFAULT_IGNORE_EXCEPTIONS @ignore_user_agents = [] @logger = Logger.new(STDOUT) @params_filters = DEFAULT_PARAMS_FILTERS @remote_host = "errorapp.com" @remote_port = nil @ssl = true end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/errorapp_notifier/config.rb', line 3 def api_key @api_key end |
#disabled_by_default ⇒ Object
Returns the value of attribute disabled_by_default.
4 5 6 |
# File 'lib/errorapp_notifier/config.rb', line 4 def disabled_by_default @disabled_by_default end |
#environment_name ⇒ Object
Returns the value of attribute environment_name.
5 6 7 |
# File 'lib/errorapp_notifier/config.rb', line 5 def environment_name @environment_name end |
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
6 7 8 |
# File 'lib/errorapp_notifier/config.rb', line 6 def http_open_timeout @http_open_timeout end |
#http_proxy_host ⇒ Object
Returns the value of attribute http_proxy_host.
7 8 9 |
# File 'lib/errorapp_notifier/config.rb', line 7 def http_proxy_host @http_proxy_host end |
#http_proxy_password ⇒ Object
Returns the value of attribute http_proxy_password.
8 9 10 |
# File 'lib/errorapp_notifier/config.rb', line 8 def http_proxy_password @http_proxy_password end |
#http_proxy_port ⇒ Object
Returns the value of attribute http_proxy_port.
9 10 11 |
# File 'lib/errorapp_notifier/config.rb', line 9 def http_proxy_port @http_proxy_port end |
#http_proxy_username ⇒ Object
Returns the value of attribute http_proxy_username.
10 11 12 |
# File 'lib/errorapp_notifier/config.rb', line 10 def http_proxy_username @http_proxy_username end |
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
11 12 13 |
# File 'lib/errorapp_notifier/config.rb', line 11 def http_read_timeout @http_read_timeout end |
#ignore_exceptions ⇒ Object
Returns the value of attribute ignore_exceptions.
12 13 14 |
# File 'lib/errorapp_notifier/config.rb', line 12 def ignore_exceptions @ignore_exceptions end |
#ignore_user_agents ⇒ Object
Returns the value of attribute ignore_user_agents.
13 14 15 |
# File 'lib/errorapp_notifier/config.rb', line 13 def ignore_user_agents @ignore_user_agents end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/errorapp_notifier/config.rb', line 14 def logger @logger end |
#params_filters ⇒ Object
Returns the value of attribute params_filters.
15 16 17 |
# File 'lib/errorapp_notifier/config.rb', line 15 def params_filters @params_filters end |
#project_root ⇒ Object
Returns the value of attribute project_root.
16 17 18 |
# File 'lib/errorapp_notifier/config.rb', line 16 def project_root @project_root end |
#remote_host ⇒ Object
Returns the value of attribute remote_host.
17 18 19 |
# File 'lib/errorapp_notifier/config.rb', line 17 def remote_host @remote_host end |
#remote_port ⇒ Object
Returns the value of attribute remote_port.
18 19 20 |
# File 'lib/errorapp_notifier/config.rb', line 18 def remote_port @remote_port end |
#ssl ⇒ Object Also known as: ssl?
Returns the value of attribute ssl.
19 20 21 |
# File 'lib/errorapp_notifier/config.rb', line 19 def ssl @ssl end |
Instance Method Details
#application_environment ⇒ Object
63 64 65 |
# File 'lib/errorapp_notifier/config.rb', line 63 def application_environment @environment_name || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development' end |
#application_root ⇒ Object
55 56 57 |
# File 'lib/errorapp_notifier/config.rb', line 55 def application_root @project_root || Dir.pwd end |
#should_send_to_api? ⇒ Boolean
51 52 53 |
# File 'lib/errorapp_notifier/config.rb', line 51 def should_send_to_api? !disabled_by_default.include?(application_environment) end |