Class: RailsInformant::Configuration
- Inherits:
-
Object
- Object
- RailsInformant::Configuration
- Defined in:
- lib/rails_informant/configuration.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
- #app_name ⇒ Object
-
#capture_errors ⇒ Object
Returns the value of attribute capture_errors.
-
#capture_user_email ⇒ Object
Returns the value of attribute capture_user_email.
-
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
-
#ignored_paths ⇒ Object
Returns the value of attribute ignored_paths.
-
#job_attempt_threshold ⇒ Object
Returns the value of attribute job_attempt_threshold.
-
#retention_days ⇒ Object
Returns the value of attribute retention_days.
-
#slack_webhook_url ⇒ Object
Returns the value of attribute slack_webhook_url.
-
#spike_protection ⇒ Object
Returns the value of attribute spike_protection.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Instance Method Summary collapse
-
#add_notifier(notifier) ⇒ Object
Register a custom notifier.
- #before_record(&block) ⇒ Object
- #before_record_callbacks ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#notifiers ⇒ Object
Returns all notifiers: built-in (auto-registered from config) + custom.
- #reset_notifiers! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_informant/configuration.rb', line 15 def initialize @before_record_callbacks = [] @api_token = ENV["INFORMANT_API_TOKEN"] @app_name = ENV["INFORMANT_APP_NAME"] @capture_errors = ENV.fetch("INFORMANT_CAPTURE_ERRORS", "true") != "false" @capture_user_email = false @custom_notifiers = [] @ignored_exceptions = ENV["INFORMANT_IGNORED_EXCEPTIONS"]&.split(",")&.map(&:strip) || [] @ignored_paths = ENV["INFORMANT_IGNORED_PATHS"]&.split(",")&.map(&:strip) || [] @job_attempt_threshold = ENV["INFORMANT_JOB_ATTEMPT_THRESHOLD"]&.to_i @retention_days = ENV["INFORMANT_RETENTION_DAYS"]&.to_i @spike_protection = nil @slack_webhook_url = ENV["INFORMANT_SLACK_WEBHOOK_URL"] @webhook_url = ENV["INFORMANT_WEBHOOK_URL"] end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def api_token @api_token end |
#app_name ⇒ Object
31 32 33 |
# File 'lib/rails_informant/configuration.rb', line 31 def app_name @app_name.presence || detect_app_name end |
#capture_errors ⇒ Object
Returns the value of attribute capture_errors.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def capture_errors @capture_errors end |
#capture_user_email ⇒ Object
Returns the value of attribute capture_user_email.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def capture_user_email @capture_user_email end |
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def ignored_exceptions @ignored_exceptions end |
#ignored_paths ⇒ Object
Returns the value of attribute ignored_paths.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def ignored_paths @ignored_paths end |
#job_attempt_threshold ⇒ Object
Returns the value of attribute job_attempt_threshold.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def job_attempt_threshold @job_attempt_threshold end |
#retention_days ⇒ Object
Returns the value of attribute retention_days.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def retention_days @retention_days end |
#slack_webhook_url ⇒ Object
Returns the value of attribute slack_webhook_url.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def slack_webhook_url @slack_webhook_url end |
#spike_protection ⇒ Object
Returns the value of attribute spike_protection.
46 47 48 |
# File 'lib/rails_informant/configuration.rb', line 46 def spike_protection @spike_protection end |
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
3 4 5 |
# File 'lib/rails_informant/configuration.rb', line 3 def webhook_url @webhook_url end |
Instance Method Details
#add_notifier(notifier) ⇒ Object
Register a custom notifier. Must respond to #notify and #should_notify?.
41 42 43 44 |
# File 'lib/rails_informant/configuration.rb', line 41 def add_notifier(notifier) @custom_notifiers << notifier @_notifiers = nil end |
#before_record(&block) ⇒ Object
55 56 57 58 |
# File 'lib/rails_informant/configuration.rb', line 55 def before_record(&block) @before_record_callbacks << block @_frozen_callbacks = nil end |
#before_record_callbacks ⇒ Object
60 61 62 |
# File 'lib/rails_informant/configuration.rb', line 60 def before_record_callbacks @_frozen_callbacks ||= @before_record_callbacks.dup.freeze end |
#notifiers ⇒ Object
Returns all notifiers: built-in (auto-registered from config) + custom.
36 37 38 |
# File 'lib/rails_informant/configuration.rb', line 36 def notifiers @_notifiers ||= built_in_notifiers + @custom_notifiers end |
#reset_notifiers! ⇒ Object
64 65 66 |
# File 'lib/rails_informant/configuration.rb', line 64 def reset_notifiers! @_notifiers = nil end |