Class: Ritm::Configuration
- Inherits:
-
Object
- Object
- Ritm::Configuration
- Defined in:
- lib/ritm/configuration.rb
Overview
Global Ritm settings
Constant Summary collapse
- DEFAULT_SETTINGS =
{ proxy: { bind_address: '127.0.0.1', bind_port: 8080 }, ssl_reverse_proxy: { bind_address: '127.0.0.1', bind_port: 8081, ca: { pem: nil, key: nil } }, intercept: { enabled: true, request: { add_headers: {}, strip_headers: [/proxy-*/], unpack_gzip_deflate: true, update_content_length: true }, response: { add_headers: { 'connection' => 'close' }, strip_headers: ['strict-transport-security'], unpack_gzip_deflate: true, update_content_length: true }, process_chunked_encoded_transfer: true }, misc: { ssl_pass_through: [] } }.freeze
Instance Method Summary collapse
-
#disable ⇒ Object
Disable interception.
-
#enable ⇒ Object
Re-enable interception.
-
#initialize(settings = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(m, *args, &block) ⇒ Object
- #reset(settings = {}) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(settings = {}) ⇒ Configuration
Returns a new instance of Configuration.
45 46 47 |
# File 'lib/ritm/configuration.rb', line 45 def initialize(settings = {}) reset(settings) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/ritm/configuration.rb', line 54 def method_missing(m, *args, &block) if @settings.respond_to?(m) @settings.send(m, *args, &block) else super end end |
Instance Method Details
#disable ⇒ Object
Disable interception
72 73 74 |
# File 'lib/ritm/configuration.rb', line 72 def disable @settings.intercept[:enabled] = false end |
#enable ⇒ Object
Re-enable interception
67 68 69 |
# File 'lib/ritm/configuration.rb', line 67 def enable @settings.intercept[:enabled] = true end |
#reset(settings = {}) ⇒ Object
49 50 51 52 |
# File 'lib/ritm/configuration.rb', line 49 def reset(settings = {}) settings = DEFAULT_SETTINGS.merge(settings) @settings = settings.to_properties end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
62 63 64 |
# File 'lib/ritm/configuration.rb', line 62 def respond_to_missing?(method_name, _include_private = false) @settings.respond_to?(method_name) || super end |