Sha256: 37ca1ff3c38f1595269471965f92456e8d9887483d07fc19b0f0c7b2f98275c6

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

require 'singleton'
require 'uri'

module Quiq
  class Config
    include Singleton

    attr_accessor :queues

    # Return a connection to the local
    # Redis instance if not configured
    def redis
      @redis ||= begin
        endpoint = Async::Redis.local_endpoint
        Async::Redis::Client.new(endpoint)
      end
    end

    # Only accepts a redis connection uri for now
    # Note the client used is far from being production ready
    def redis=(server)
      uri = URI(server)
      endpoint = Async::IO::Endpoint.tcp(uri.host, uri.port)
      @redis = Async::Redis::Client.new(endpoint)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quiq-0.1.0 lib/quiq/config.rb