Class: ValidationTrackerClient::Configuration
- Inherits:
-
Object
- Object
- ValidationTrackerClient::Configuration
- Defined in:
- lib/validation_tracker_client/configuration.rb
Overview
Used to set up and modify settings for the notifier.
Constant Summary collapse
- OPTIONS =
[:api_key, :development_environments, :development_lookup, :environment_name, :host, :http_open_timeout, :http_read_timeout, :notifier_name, :notifier_url, :notifier_version, :params_filters, :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port, :proxy_user, :secure, :framework, :user_information].freeze
- DEFAULT_PARAMS_FILTERS =
%w(password password_confirmation).freeze
- DEFAULT_BACKTRACE_FILTERS =
[ lambda { |line| if defined?(ValidationTrackerClient.configuration.project_root) && ValidationTrackerClient.configuration.project_root.to_s != '' line.gsub(/#{ValidationTrackerClient.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/validation_tracker_client} } ].freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
The API key for your project, found on the project edit form.
-
#development_environments ⇒ Object
A list of environments in which notifications should not be sent.
-
#development_lookup ⇒ Object
trueif you want to check for production errors matching development errors,falseotherwise. -
#environment_name ⇒ Object
The name of the environment the application is running in.
-
#framework ⇒ Object
The framework ValidationTrackerClient is configured to use.
-
#host ⇒ Object
The host to connect to (defaults to validation-tracker.heroku.com).
-
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds (defaults to 2).
-
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds (defaults to 5).
-
#logger ⇒ Object
The logger used by ValidationTrackerClient.
-
#notifier_name ⇒ Object
The name of the notifier library being used to send notifications (such as “Validation Tracker Notifier”).
-
#notifier_url ⇒ Object
The url of the notifier library being used to send notifications.
-
#notifier_version ⇒ Object
The version of the notifier library being used to send notifications (such as “1.0.2”).
-
#params_filters ⇒ Object
readonly
A list of parameters that should be filtered out of what is sent to Validation Tracker.
-
#port ⇒ Object
The port on which your Validation Tracker server runs (defaults to 443 for secure connections, 80 for insecure connections).
-
#project_root ⇒ Object
The path to the project in which the error occurred, such as the RAILS_ROOT.
-
#proxy_host ⇒ Object
The hostname of your proxy server (if using a proxy).
-
#proxy_pass ⇒ Object
The password to use when logging into your proxy server (if using a proxy).
-
#proxy_port ⇒ Object
The port of your proxy server (if using a proxy).
-
#proxy_user ⇒ Object
The username to use when logging into your proxy server (if using a proxy).
-
#secure ⇒ Object
(also: #secure?)
truefor https connections,falsefor http connections. -
#user_information ⇒ Object
The text that the placeholder is replaced with.
Instance Method Summary collapse
-
#[](option) ⇒ Object
Allows config options to be read like a hash.
- #environment_filters ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#merge(hash) ⇒ Object
Returns a hash of all configurable options merged with
hash. - #protocol ⇒ Object
-
#public? ⇒ Boolean
Determines if the notifier will send notices.
-
#to_hash ⇒ Object
Returns a hash of all configurable options.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/validation_tracker_client/configuration.rb', line 102 def initialize @secure = false @host = 'validation-tracker.heroku.com' @http_open_timeout = 2 @http_read_timeout = 5 @params_filters = DEFAULT_PARAMS_FILTERS.dup @ignore_user_agent = [] @development_environments = %w(test cucumber) @development_lookup = true @notifier_name = 'Validation Tracker Notifier' @notifier_version = VERSION @notifier_url = 'http://validation-tracker.heroku.com' @framework = 'Standalone' @user_information = 'Validation Tracker Error {{error_id}}' end |
Instance Attribute Details
#api_key ⇒ Object
The API key for your project, found on the project edit form.
14 15 16 |
# File 'lib/validation_tracker_client/configuration.rb', line 14 def api_key @api_key end |
#development_environments ⇒ Object
A list of environments in which notifications should not be sent.
49 50 51 |
# File 'lib/validation_tracker_client/configuration.rb', line 49 def development_environments @development_environments end |
#development_lookup ⇒ Object
true if you want to check for production errors matching development errors, false otherwise.
52 53 54 |
# File 'lib/validation_tracker_client/configuration.rb', line 52 def development_lookup @development_lookup end |
#environment_name ⇒ Object
The name of the environment the application is running in
55 56 57 |
# File 'lib/validation_tracker_client/configuration.rb', line 55 def environment_name @environment_name end |
#framework ⇒ Object
The framework ValidationTrackerClient is configured to use
76 77 78 |
# File 'lib/validation_tracker_client/configuration.rb', line 76 def framework @framework end |
#host ⇒ Object
The host to connect to (defaults to validation-tracker.heroku.com).
17 18 19 |
# File 'lib/validation_tracker_client/configuration.rb', line 17 def host @host end |
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds (defaults to 2).
27 28 29 |
# File 'lib/validation_tracker_client/configuration.rb', line 27 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds (defaults to 5).
30 31 32 |
# File 'lib/validation_tracker_client/configuration.rb', line 30 def http_read_timeout @http_read_timeout end |
#logger ⇒ Object
The logger used by ValidationTrackerClient
70 71 72 |
# File 'lib/validation_tracker_client/configuration.rb', line 70 def logger @logger end |
#notifier_name ⇒ Object
The name of the notifier library being used to send notifications (such as “Validation Tracker Notifier”)
61 62 63 |
# File 'lib/validation_tracker_client/configuration.rb', line 61 def notifier_name @notifier_name end |
#notifier_url ⇒ Object
The url of the notifier library being used to send notifications
67 68 69 |
# File 'lib/validation_tracker_client/configuration.rb', line 67 def notifier_url @notifier_url end |
#notifier_version ⇒ Object
The version of the notifier library being used to send notifications (such as “1.0.2”)
64 65 66 |
# File 'lib/validation_tracker_client/configuration.rb', line 64 def notifier_version @notifier_version end |
#params_filters ⇒ Object (readonly)
A list of parameters that should be filtered out of what is sent to Validation Tracker. By default, all “password” attributes will have their contents replaced.
46 47 48 |
# File 'lib/validation_tracker_client/configuration.rb', line 46 def params_filters @params_filters end |
#port ⇒ Object
The port on which your Validation Tracker server runs (defaults to 443 for secure connections, 80 for insecure connections).
21 22 23 |
# File 'lib/validation_tracker_client/configuration.rb', line 21 def port @port end |
#project_root ⇒ Object
The path to the project in which the error occurred, such as the RAILS_ROOT
58 59 60 |
# File 'lib/validation_tracker_client/configuration.rb', line 58 def project_root @project_root end |
#proxy_host ⇒ Object
The hostname of your proxy server (if using a proxy)
33 34 35 |
# File 'lib/validation_tracker_client/configuration.rb', line 33 def proxy_host @proxy_host end |
#proxy_pass ⇒ Object
The password to use when logging into your proxy server (if using a proxy)
42 43 44 |
# File 'lib/validation_tracker_client/configuration.rb', line 42 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
The port of your proxy server (if using a proxy)
36 37 38 |
# File 'lib/validation_tracker_client/configuration.rb', line 36 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
The username to use when logging into your proxy server (if using a proxy)
39 40 41 |
# File 'lib/validation_tracker_client/configuration.rb', line 39 def proxy_user @proxy_user end |
#secure ⇒ Object Also known as: secure?
true for https connections, false for http connections.
24 25 26 |
# File 'lib/validation_tracker_client/configuration.rb', line 24 def secure @secure end |
#user_information ⇒ Object
The text that the placeholder is replaced with. {error_id} is the actual error number.
73 74 75 |
# File 'lib/validation_tracker_client/configuration.rb', line 73 def user_information @user_information end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
122 123 124 |
# File 'lib/validation_tracker_client/configuration.rb', line 122 def [](option) send(option) end |
#environment_filters ⇒ Object
158 159 160 161 |
# File 'lib/validation_tracker_client/configuration.rb', line 158 def environment_filters warn 'config.environment_filters has been deprecated and has no effect.' [] end |
#merge(hash) ⇒ Object
Returns a hash of all configurable options merged with hash
136 137 138 |
# File 'lib/validation_tracker_client/configuration.rb', line 136 def merge(hash) to_hash.merge(hash) end |
#protocol ⇒ Object
150 151 152 153 154 155 156 |
# File 'lib/validation_tracker_client/configuration.rb', line 150 def protocol if secure? 'https' else 'http' end end |
#public? ⇒ Boolean
Determines if the notifier will send notices.
142 143 144 |
# File 'lib/validation_tracker_client/configuration.rb', line 142 def public? !development_environments.include?(environment_name) end |
#to_hash ⇒ Object
Returns a hash of all configurable options
127 128 129 130 131 |
# File 'lib/validation_tracker_client/configuration.rb', line 127 def to_hash OPTIONS.inject({}) do |hash, option| hash.merge(option.to_sym => send(option)) end end |