Class: Ritm::Configuration
- Inherits:
-
Object
- Object
- Ritm::Configuration
- Defined in:
- lib/ritm/configuration.rb
Instance Method Summary collapse
-
#default_settings ⇒ Object
rubocop:disable Metrics/MethodLength.
- #disable ⇒ Object
- #enable ⇒ Object
-
#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.
46 47 48 |
# File 'lib/ritm/configuration.rb', line 46 def initialize reset 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
#default_settings ⇒ Object
rubocop:disable Metrics/MethodLength
6 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 |
# File 'lib/ritm/configuration.rb', line 6 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
66 67 68 |
# File 'lib/ritm/configuration.rb', line 66 def disable @settings.intercept[:enabled] = false end |
#enable ⇒ Object
62 63 64 |
# File 'lib/ritm/configuration.rb', line 62 def enable @settings.intercept[:enabled] = true end |
#reset ⇒ Object
50 51 52 |
# File 'lib/ritm/configuration.rb', line 50 def reset @settings = default_settings.to_properties end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
70 71 72 |
# File 'lib/ritm/configuration.rb', line 70 def respond_to_missing?(method_name, _include_private = false) @settings.respond_to?(method_name) || super end |