Class: Ritm::Configuration
- Inherits:
-
Object
- Object
- Ritm::Configuration
- Defined in:
- lib/ritm/configuration.rb
Overview
Global Ritm settings
Instance Method Summary collapse
-
#default_settings ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#disable ⇒ Object
Disable interception.
-
#enable ⇒ Object
Re-enable interception.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(m, *args, &block) ⇒ Object
- #reset ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
47 48 49 |
# File 'lib/ritm/configuration.rb', line 47 def initialize reset end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/ritm/configuration.rb', line 55 def method_missing(m, *args, &block) if @settings.respond_to?(m) @settings.send(m, *args, &block) else super end end |
Instance Method Details
#default_settings ⇒ Object
rubocop:disable Metrics/MethodLength
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ritm/configuration.rb', line 7 def default_settings # rubocop:disable Metrics/MethodLength { 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: [], upstream_proxy: nil } } end |
#disable ⇒ Object
Disable interception
69 70 71 |
# File 'lib/ritm/configuration.rb', line 69 def disable @settings.intercept[:enabled] = false end |
#enable ⇒ Object
Re-enable interception
64 65 66 |
# File 'lib/ritm/configuration.rb', line 64 def enable @settings.intercept[:enabled] = true end |
#reset ⇒ Object
51 52 53 |
# File 'lib/ritm/configuration.rb', line 51 def reset @settings = default_settings.to_properties end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
73 74 75 |
# File 'lib/ritm/configuration.rb', line 73 def respond_to_missing?(method_name, _include_private = false) @settings.respond_to?(method_name) || super end |