class RabbitMQHttpAuthBackend::Config

Constants

DEFAULT_CFG_KEY
DEFAULT_VALUES
DENY_PROC

Attributes

version[R]

Public Class Methods

configuration() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 27
def self.configuration
  @configuration ||= { default_configuration_key => default_configuration }
end
default_configuration() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 43
def self.default_configuration
  {}.merge(DEFAULT_VALUES)
end
default_configuration_key() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 39
def self.default_configuration_key
  DEFAULT_CFG_KEY
end
new(version = DEFAULT_CFG_KEY) click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 55
def initialize(version = DEFAULT_CFG_KEY)
  @version = version.to_sym
end
reset!() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 31
def self.reset!
  @configuration = { default_configuration_key => default_configuration }
end
version(version) click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 47
def self.version(version)
  return unless versions.include?(version)

  new(version)
end
versions() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 35
def self.versions
  configuration.keys
end

Public Instance Methods

fetch(resource, element) click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 95
def fetch(resource, element)
  method = "#{resource}_#{element}".to_sym
  return nil unless respond_to?(method)
  public_send(method)
end
http_method() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 59
def http_method
  data[:http_method]
end
resource_path() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 79
def resource_path
  sanitize_path(data[:resource_path])
end
resource_resolver() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 83
def resource_resolver
  data[:resource_resolver]
end
topic_path() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 87
def topic_path
  sanitize_path(data[:topic_path])
end
topic_resolver() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 91
def topic_resolver
  data[:topic_resolver]
end
user_path() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 63
def user_path
  sanitize_path(data[:user_path])
end
user_resolver() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 67
def user_resolver
  data[:user_resolver]
end
vhost_path() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 71
def vhost_path
  sanitize_path(data[:vhost_path])
end
vhost_resolver() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 75
def vhost_resolver
  data[:vhost_resolver]
end

Private Instance Methods

data() click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 103
def data
  @data ||= begin
    defaults = self.class.configuration[DEFAULT_CFG_KEY]
    cfg = self.class.configuration[version] || {}
    defaults.merge(cfg).freeze
  end
end
sanitize_path(path) click to toggle source
# File lib/rabbitmq_http_auth_backend/config.rb, line 111
def sanitize_path(path)
  path.gsub(%r{^/}, '')
end