Sha256: 7f2534f828ed0b001fb3e90aacbe7e0f6262378e66bddac1c4fd3eb26a7a92fe
Contents?: true
Size: 1.35 KB
Versions: 13
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true require_relative '../vendor/resolver' module Datadog module Tracing module Contrib module Redis module Configuration UNIX_SCHEME = 'unix' # Converts String URLs and Hashes to a normalized connection settings Hash. class Resolver < Contrib::Configuration::Resolver # @param [Hash,String] Redis connection information def resolve(hash) super(parse_matcher(hash)) end protected def parse_matcher(matcher) matcher = { url: matcher } if matcher.is_a?(String) normalize(connection_resolver.resolve(matcher)) end def normalize(hash) return { url: hash[:url] } if hash[:scheme] == UNIX_SCHEME # Connexion strings are always converted to host, port, db and scheme # but the host, port, db and scheme will generate the :url only after # establishing a first connexion { host: hash[:host], port: hash[:port], db: hash[:db], scheme: hash[:scheme] } end def connection_resolver @connection_resolver ||= Vendor::Resolver.new end end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems