Coder Social home page Coder Social logo

async-job's Issues

Allow basic auth for Redis clients

I ran into an issue that seems similar to socketry/async-redis#35

I have a URL like so:

rediss://:[email protected]:10954

...but in lib/async/job/backend/redis.rb I can't include protocol as in the example.

My config is a bit convoluted, but I believe otherwise working:

    # used for Sidekiq
    config.redis_ssl_params = {
      cert_store: OpenSSL::X509::Store.new.tap { |store|
        store.add_file(Rails.root.join("config/redis.pem").to_s)
      },
      cert: OpenSSL::X509::Certificate.new(File.read(
        Rails.root.join("config/redis.crt")
      )),
      key: OpenSSL::PKey::RSA.new(
        Rails.application.credentials.services.redis.private_key
      ),
      verify_mode: OpenSSL::SSL::VERIFY_PEER
    }

    # building for use in async-job
    config.redis_ssl_context = OpenSSL::SSL::SSLContext.new.tap do |context|
      context.cert_store = config.redis_ssl_params[:cert_store]
      context.cert = config.redis_ssl_params[:cert]
      context.key = config.redis_ssl_params[:key]
      context.verify_mode = config.redis_ssl_params[:verify_mode]
    end

  config.async_job.backend_for "redis_remote" do
		uri = URI(ENV["REDIS_ASYNC_JOB_URL"])
    queue Async::Job::Backend::Redis, endpoint: Async::IO::SSLEndpoint.new(Async::IO::Endpoint.tcp(uri.hostname, uri.port), ssl_context: Rails.configuration.redis_ssl_context)
	end

Perhaps there's an easier way to configure, or maybe we can figure out how to get it working and provide an integration guide, but in any case I'd need to be able to get the password passed through somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.