module RedisClient::Config::Common

def server_url

def server_url
  if path
    url = "unix://#{path}"
    if db != 0
      url = "#{url}?db=#{db}"
    end
  else
    # add brackets to IPv6 address
    redis_host = if host.count(":") >= 2
      "[#{host}]"
    else
      host
    end
    url = "redis#{'s' if ssl?}://#{redis_host}:#{port}"
    if db != 0
      url = "#{url}/#{db}"
    end
  end
  url
end