Class: TgErrorNotifier::Configuration
- Inherits:
-
Object
- Object
- TgErrorNotifier::Configuration
- Defined in:
- lib/tg_error_notifier/configuration.rb
Instance Attribute Summary collapse
-
#active_job_enabled ⇒ Object
Returns the value of attribute active_job_enabled.
-
#api_base ⇒ Object
Returns the value of attribute api_base.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#bot_token ⇒ Object
Returns the value of attribute bot_token.
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#chat_id ⇒ Object
Returns the value of attribute chat_id.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#grouping_enabled ⇒ Object
Returns the value of attribute grouping_enabled.
-
#grouping_window ⇒ Object
Returns the value of attribute grouping_window.
-
#ignored_environments ⇒ Object
Returns the value of attribute ignored_environments.
-
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
-
#include_backtrace ⇒ Object
Returns the value of attribute include_backtrace.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_backtrace_lines ⇒ Object
Returns the value of attribute max_backtrace_lines.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
-
#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.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#topic_icon_color ⇒ Object
Returns the value of attribute topic_icon_color.
-
#topic_store_read ⇒ Object
Returns the value of attribute topic_store_read.
-
#topic_store_write ⇒ Object
Returns the value of attribute topic_store_write.
-
#topics_enabled ⇒ Object
Returns the value of attribute topics_enabled.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #proxy? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/tg_error_notifier/configuration.rb', line 31 def initialize @enabled = true @bot_token = ENV["TELEGRAM_BOT_TOKEN"] @chat_id = ENV["TELEGRAM_ERRORS_CHAT_ID"] @api_base = "https://api.telegram.org" @environment = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" @app_name = ENV["TELEGRAM_ERRORS_APP_NAME"] || "Rails App" @max_backtrace_lines = 20 @ignored_exceptions = [ "ActionController::RoutingError", "ActiveRecord::RecordNotFound", "ActionController::UnknownFormat" ] @ignored_environments = ["test"] @open_timeout = 2 @read_timeout = 5 @logger = nil @include_backtrace = true @active_job_enabled = true @proxy_addr = nil @proxy_port = nil @proxy_user = nil @proxy_pass = nil @grouping_enabled = false @grouping_window = 60 @topics_enabled = false @topic_icon_color = nil # Persistent storage for named topics (created via capture_message topic:). # Without a store each process/restart would create a duplicate forum topic. # topic_store_read = ->(name) { ... } # returns thread_id or nil # topic_store_write = ->(name, thread_id) { ... } @topic_store_read = nil @topic_store_write = nil # Inline keyboard attached under the message. The gem does not interpret # the buttons: whatever the host returns goes to Telegram as is, so the # host is free to use url buttons, callback_data or web_app. # # config.buttons = lambda do |kind:, source:, context:, fingerprint:, exception: nil, message: nil| # [[{ text: "To the board", url: "https://example.com/e/#{token}" }]] # end # # Return value: array of rows, each row an array of button hashes. # A flat array of buttons is accepted too and becomes a single row. # Return nil or [] for no keyboard. Errors raised inside are logged and # the message is still delivered, without the keyboard. = nil end |
Instance Attribute Details
#active_job_enabled ⇒ Object
Returns the value of attribute active_job_enabled.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def active_job_enabled @active_job_enabled end |
#api_base ⇒ Object
Returns the value of attribute api_base.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def api_base @api_base end |
#app_name ⇒ Object
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def app_name @app_name end |
#bot_token ⇒ Object
Returns the value of attribute bot_token.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def bot_token @bot_token end |
#buttons ⇒ Object
Returns the value of attribute buttons.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def end |
#chat_id ⇒ Object
Returns the value of attribute chat_id.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def chat_id @chat_id end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def enabled @enabled end |
#environment ⇒ Object
Returns the value of attribute environment.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def environment @environment end |
#grouping_enabled ⇒ Object
Returns the value of attribute grouping_enabled.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def grouping_enabled @grouping_enabled end |
#grouping_window ⇒ Object
Returns the value of attribute grouping_window.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def grouping_window @grouping_window end |
#ignored_environments ⇒ Object
Returns the value of attribute ignored_environments.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def ignored_environments @ignored_environments end |
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def ignored_exceptions @ignored_exceptions end |
#include_backtrace ⇒ Object
Returns the value of attribute include_backtrace.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def include_backtrace @include_backtrace end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def logger @logger end |
#max_backtrace_lines ⇒ Object
Returns the value of attribute max_backtrace_lines.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def max_backtrace_lines @max_backtrace_lines end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def open_timeout @open_timeout end |
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def proxy_addr @proxy_addr end |
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def proxy_user @proxy_user end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def read_timeout @read_timeout end |
#topic_icon_color ⇒ Object
Returns the value of attribute topic_icon_color.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def topic_icon_color @topic_icon_color end |
#topic_store_read ⇒ Object
Returns the value of attribute topic_store_read.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def topic_store_read @topic_store_read end |
#topic_store_write ⇒ Object
Returns the value of attribute topic_store_write.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def topic_store_write @topic_store_write end |
#topics_enabled ⇒ Object
Returns the value of attribute topics_enabled.
5 6 7 |
# File 'lib/tg_error_notifier/configuration.rb', line 5 def topics_enabled @topics_enabled end |
Instance Method Details
#proxy? ⇒ Boolean
79 80 81 |
# File 'lib/tg_error_notifier/configuration.rb', line 79 def proxy? proxy_addr.present? && proxy_port.present? end |