Class: Twirp::Rails::Configuration
- Inherits:
-
Object
- Object
- Twirp::Rails::Configuration
- Defined in:
- lib/twirp/rails/configuration.rb
Instance Attribute Summary collapse
-
#auto_mount ⇒ Object
Whether to automatically mount routes at endpoint.
-
#endpoint ⇒ Object
Where to mount twirp routes.
-
#load_paths ⇒ Object
An array of directories to search for *_twirp.rb files Defaults to [“lib”].
-
#logger ⇒ Object
Logger to use for Twirp requests.
-
#middleware ⇒ Object
An array of Rack middleware to use.
-
#service_hooks ⇒ Object
A hash of lambdas that accepts |rack_env, env| and is passed to Twirp::Service See: github.com/twitchtv/twirp-ruby/wiki/Service-Hooks for available hooks.
-
#verbose_logging ⇒ Object
Whether to log full Twirp responses.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
33 34 35 36 37 38 39 40 41 |
# File 'lib/twirp/rails/configuration.rb', line 33 def initialize @auto_mount = false @endpoint = "/twirp" @load_paths = ["lib"] @logger = Logger @verbose_logging = false @middleware = [] @service_hooks = {} end |
Instance Attribute Details
#auto_mount ⇒ Object
Whether to automatically mount routes at endpoint. Defaults to false
7 8 9 |
# File 'lib/twirp/rails/configuration.rb', line 7 def auto_mount @auto_mount end |
#endpoint ⇒ Object
Where to mount twirp routes. Defaults to /twirp
10 11 12 |
# File 'lib/twirp/rails/configuration.rb', line 10 def endpoint @endpoint end |
#load_paths ⇒ Object
An array of directories to search for *_twirp.rb files Defaults to [“lib”]
23 24 25 |
# File 'lib/twirp/rails/configuration.rb', line 23 def load_paths @load_paths end |
#logger ⇒ Object
Logger to use for Twirp requests. Defaults to Rails.logger
13 14 15 |
# File 'lib/twirp/rails/configuration.rb', line 13 def logger @logger end |
#middleware ⇒ Object
An array of Rack middleware to use
26 27 28 |
# File 'lib/twirp/rails/configuration.rb', line 26 def middleware @middleware end |
#service_hooks ⇒ Object
A hash of lambdas that accepts |rack_env, env| and is passed to Twirp::Service See: github.com/twitchtv/twirp-ruby/wiki/Service-Hooks for available hooks
31 32 33 |
# File 'lib/twirp/rails/configuration.rb', line 31 def service_hooks @service_hooks end |
#verbose_logging ⇒ Object
Whether to log full Twirp responses. Can be useful for debugging, but can expose sensitive data. Defauts to false Example:
Twirp Response: <Twirp::Example::Haberdasher::Hat: inches: 24, color: "Tan", name: "Pork Pie">
19 20 21 |
# File 'lib/twirp/rails/configuration.rb', line 19 def verbose_logging @verbose_logging end |