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 } }.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
Constructor Details
#initialize(settings = {}) ⇒ Configuration
39 40 41 |
# File 'lib/ritm/configuration.rb', line 39 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
48 49 50 |
# File 'lib/ritm/configuration.rb', line 48 def method_missing(m, *args, &block) @settings.send(m, *args, &block) end |
Instance Method Details
#disable ⇒ Object
Disable interception
58 59 60 |
# File 'lib/ritm/configuration.rb', line 58 def disable @settings.intercept[:enabled] = false end |
#enable ⇒ Object
Re-enable interception
53 54 55 |
# File 'lib/ritm/configuration.rb', line 53 def enable @settings.intercept[:enabled] = true end |
#reset(settings = {}) ⇒ Object
43 44 45 46 |
# File 'lib/ritm/configuration.rb', line 43 def reset(settings = {}) settings = DEFAULT_SETTINGS.merge(settings) @settings = settings.to_properties end |