gush icon indicating copy to clipboard operation
gush copied to clipboard

Allow configuring redis via a option hash

Open wnm opened this issue 2 years ago • 5 comments

Redis 6+ requires SSL to connect. Heroku does not use SSL, they use HTTP routing instead.

This PR allows to configure Redis via an option hash like:

# config/initializers/gush.rb
Gush.configure do |config|
  config.redis = { url: "redis://localhost:6379", ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }}
end

wnm avatar May 04 '23 08:05 wnm

Thank you for this! A good addition regardless of changes in Rails :)

pokonski avatar May 04 '23 08:05 pokonski

glad you like it @pokonski, for what its worth we are running the fork with the code in this PR in production right now and it works as expected. Would love to get back to using the upstream version though, instead of using our own fork. Let me know if you need anything in order to merge this in!?

wnm avatar Jun 01 '23 09:06 wnm

That is indeed great to know it runs well, I just need a bit time to release it, but will definitely do soon!

pokonski avatar Jun 01 '23 09:06 pokonski

Some time ago, we also needed to slightly modify the settings for Gush in order to pass additional options to the Redis initialization.

In our case, Redis access was password-protected, and we added this option in a fork of the repository. Today, we also have projects running in production with this modified version.

I was thinking of contributing to the project by suggesting adding this option, then I saw this pull request that allows passing many options to Redis, and I realized that it would also solve the password case.

It would be great to have this in the official version. I would suggest keeping the option to inform only the hash instead of also having the url option, to keep the Redis configuration centralized.

Furthermore, congratulations and thank you for the project, it's a real lifesaver for asynchronous executions, and thanks to @wnm for taking the initiative to open this PR!

denisstael avatar Oct 24 '23 06:10 denisstael

@pokonski any updates on this 😇

wnm avatar Mar 22 '24 08:03 wnm

just one more friendly push if we can merge this? would be nice to eventually land upstream, and not use our own fork 😊

wnm avatar Jun 11 '24 10:06 wnm

Hey @wnm, we now have #108. Will that be enough? It's available in 3.0

pokonski avatar Jun 11 '24 10:06 pokonski

Ah fantastic, that sure is enough!! thanks so much 🙌

wnm avatar Jun 11 '24 10:06 wnm

And thanks again for the change, sorry about the duplication - it completely slipped my mind that we already had your PR for this!

pokonski avatar Jun 11 '24 10:06 pokonski

@pokonski hehe no worries 😊

I just installed version 3.0.0 but I'm getting a NoMethodError: undefined method redis= for #<Gush::Configuration:, and when I run bundle open gush and inspect the code, I don't see the changes from #108. I can see the PR is merged, but I don't think it landed in 3.0.0?

wnm avatar Jun 12 '24 06:06 wnm