class Ritm::Configuration

Public Class Methods

new() click to toggle source
# File lib/ritm/configuration.rb, line 46
def initialize
  reset
end

Public Instance Methods

default_settings() click to toggle source
# 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() click to toggle source
# File lib/ritm/configuration.rb, line 66
def disable
  @settings.intercept[:enabled] = false
end
enable() click to toggle source
# File lib/ritm/configuration.rb, line 62
def enable
  @settings.intercept[:enabled] = true
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# 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
reset() click to toggle source
# File lib/ritm/configuration.rb, line 50
def reset
  @settings = default_settings.to_properties
end
respond_to_missing?(method_name, _include_private = false) click to toggle source
Calls superclass method
# File lib/ritm/configuration.rb, line 70
def respond_to_missing?(method_name, _include_private = false)
  @settings.respond_to?(method_name) || super
end