Class: Opbeat::Configuration
- Inherits:
-
Object
- Object
- Opbeat::Configuration
- Defined in:
- lib/opbeat/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ server: "https://intake.opbeat.com".freeze, logger: Logger.new(nil), context_lines: 3, enabled_environments: %w{production}, excluded_exceptions: [], filter_parameters: [/(authorization|password|passwd|secret)/i], timeout: 100, open_timeout: 100, backoff_multiplier: 2, use_ssl: true, current_user_method: :current_user, environment: ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'default', transaction_post_interval: 60, disable_performance: false, disable_errors: false, debug_traces: false, # for tests disable_worker: false }.freeze
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#backoff_multiplier ⇒ Object
Returns the value of attribute backoff_multiplier.
-
#context_lines ⇒ Object
Returns the value of attribute context_lines.
-
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
-
#debug_traces ⇒ Object
Returns the value of attribute debug_traces.
-
#disable_errors ⇒ Object
Returns the value of attribute disable_errors.
-
#disable_performance ⇒ Object
Returns the value of attribute disable_performance.
-
#disable_worker ⇒ Object
Returns the value of attribute disable_worker.
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#excluded_exceptions ⇒ Object
Returns the value of attribute excluded_exceptions.
-
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#secret_token ⇒ Object
Returns the value of attribute secret_token.
-
#server ⇒ Object
Returns the value of attribute server.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#transaction_post_interval ⇒ Object
Returns the value of attribute transaction_post_interval.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#view_paths ⇒ Object
Returns the value of attribute view_paths.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration
56 57 58 59 60 61 62 63 64 |
# File 'lib/opbeat/configuration.rb', line 56 def initialize opts = {} DEFAULTS.merge(opts).each do |k, v| self.send("#{k}=", v) end if block_given? yield self end end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id
31 32 33 |
# File 'lib/opbeat/configuration.rb', line 31 def app_id @app_id end |
#backoff_multiplier ⇒ Object
Returns the value of attribute backoff_multiplier
41 42 43 |
# File 'lib/opbeat/configuration.rb', line 41 def backoff_multiplier @backoff_multiplier end |
#context_lines ⇒ Object
Returns the value of attribute context_lines
35 36 37 |
# File 'lib/opbeat/configuration.rb', line 35 def context_lines @context_lines end |
#current_user_method ⇒ Object
Returns the value of attribute current_user_method
43 44 45 |
# File 'lib/opbeat/configuration.rb', line 43 def current_user_method @current_user_method end |
#debug_traces ⇒ Object
Returns the value of attribute debug_traces
50 51 52 |
# File 'lib/opbeat/configuration.rb', line 50 def debug_traces @debug_traces end |
#disable_errors ⇒ Object
Returns the value of attribute disable_errors
48 49 50 |
# File 'lib/opbeat/configuration.rb', line 48 def disable_errors @disable_errors end |
#disable_performance ⇒ Object
Returns the value of attribute disable_performance
47 48 49 |
# File 'lib/opbeat/configuration.rb', line 47 def disable_performance @disable_performance end |
#disable_worker ⇒ Object
Returns the value of attribute disable_worker
52 53 54 |
# File 'lib/opbeat/configuration.rb', line 52 def disable_worker @disable_worker end |
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments
36 37 38 |
# File 'lib/opbeat/configuration.rb', line 36 def enabled_environments @enabled_environments end |
#environment ⇒ Object
Returns the value of attribute environment
44 45 46 |
# File 'lib/opbeat/configuration.rb', line 44 def environment @environment end |
#excluded_exceptions ⇒ Object
Returns the value of attribute excluded_exceptions
37 38 39 |
# File 'lib/opbeat/configuration.rb', line 37 def excluded_exceptions @excluded_exceptions end |
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters
38 39 40 |
# File 'lib/opbeat/configuration.rb', line 38 def filter_parameters @filter_parameters end |
#logger ⇒ Object
Returns the value of attribute logger
34 35 36 |
# File 'lib/opbeat/configuration.rb', line 34 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout
40 41 42 |
# File 'lib/opbeat/configuration.rb', line 40 def open_timeout @open_timeout end |
#organization_id ⇒ Object
Returns the value of attribute organization_id
30 31 32 |
# File 'lib/opbeat/configuration.rb', line 30 def organization_id @organization_id end |
#secret_token ⇒ Object
Returns the value of attribute secret_token
29 30 31 |
# File 'lib/opbeat/configuration.rb', line 29 def secret_token @secret_token end |
#server ⇒ Object
Returns the value of attribute server
33 34 35 |
# File 'lib/opbeat/configuration.rb', line 33 def server @server end |
#timeout ⇒ Object
Returns the value of attribute timeout
39 40 41 |
# File 'lib/opbeat/configuration.rb', line 39 def timeout @timeout end |
#transaction_post_interval ⇒ Object
Returns the value of attribute transaction_post_interval
45 46 47 |
# File 'lib/opbeat/configuration.rb', line 45 def transaction_post_interval @transaction_post_interval end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl
42 43 44 |
# File 'lib/opbeat/configuration.rb', line 42 def use_ssl @use_ssl end |
#view_paths ⇒ Object
Returns the value of attribute view_paths
54 55 56 |
# File 'lib/opbeat/configuration.rb', line 54 def view_paths @view_paths end |
Instance Method Details
#validate! ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/opbeat/configuration.rb', line 66 def validate! %w{app_id secret_token organization_id}.each do |key| raise Error.new("Configuration missing `#{key}'") unless self.send(key) end true rescue Error => e logger.error e. false end |