Class: BoltRb::Configuration
- Inherits:
-
Object
- Object
- BoltRb::Configuration
- Defined in:
- lib/bolt_rb/configuration.rb
Overview
Configuration class for BoltRb applications
Holds all settings including tokens, handler paths, logger, middleware stack, and error handling configuration.
Instance Attribute Summary collapse
-
#app_token ⇒ Object
Returns the value of attribute app_token.
-
#assistant_thread_context_store ⇒ Object
Return the store for assistant thread context.
-
#bot_token ⇒ Object
Returns the value of attribute bot_token.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#handler_paths ⇒ Object
Returns the value of attribute handler_paths.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#middleware ⇒ Object
readonly
Returns the value of attribute middleware.
-
#signing_secret ⇒ Object
Returns the value of attribute signing_secret.
-
#worker_threads ⇒ Integer
Number of threads that run handlers.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#use(middleware_class) ⇒ Array<Class>
Add middleware to the stack.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
34 35 36 37 38 39 40 |
# File 'lib/bolt_rb/configuration.rb', line 34 def initialize @handler_paths = ['app/slack_handlers'] @logger = Logger.new($stdout) @logger.level = Logger::INFO @middleware = [BoltRb::Middleware::Logging] @worker_threads = 5 end |
Instance Attribute Details
#app_token ⇒ Object
Returns the value of attribute app_token.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def app_token @app_token end |
#assistant_thread_context_store ⇒ Object
Return the store for assistant thread context
Defaults to an in-process memory store. Any object that responds to
get(channel_id:, thread_ts:) and save(channel_id:, thread_ts:, context:)
can replace it.
49 50 51 |
# File 'lib/bolt_rb/configuration.rb', line 49 def assistant_thread_context_store @assistant_thread_context_store ||= BoltRb::Assistant::MemoryThreadContextStore.new end |
#bot_token ⇒ Object
Returns the value of attribute bot_token.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def bot_token @bot_token end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def error_handler @error_handler end |
#handler_paths ⇒ Object
Returns the value of attribute handler_paths.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def handler_paths @handler_paths end |
#logger ⇒ Object
Returns the value of attribute logger.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def logger @logger end |
#middleware ⇒ Object (readonly)
Returns the value of attribute middleware.
32 33 34 |
# File 'lib/bolt_rb/configuration.rb', line 32 def middleware @middleware end |
#signing_secret ⇒ Object
Returns the value of attribute signing_secret.
24 25 26 |
# File 'lib/bolt_rb/configuration.rb', line 24 def signing_secret @signing_secret end |
#worker_threads ⇒ Integer
Returns Number of threads that run handlers. Default 5.
28 29 30 |
# File 'lib/bolt_rb/configuration.rb', line 28 def worker_threads @worker_threads end |
Instance Method Details
#use(middleware_class) ⇒ Array<Class>
Add middleware to the stack
57 58 59 |
# File 'lib/bolt_rb/configuration.rb', line 57 def use(middleware_class) @middleware << middleware_class end |