Change ActionCable Redis default production URL

config/cable.yml

Desired implementation

production:

adapter: redis

url: <%= ENV[“REDIS_URL”] %>

Actual implementation

production:

adapter: redis

url: redis://localhost:6379/1

Why?

  1. In real life, most instances won’t be using a locally hosted version of redis

  2. Always better to hide info about production

  3. Will more easily integrate with third party software

Let me know your thoughts

I don’t think we gain by moving this configuration to an ENV. There are no passwords present here, so hiding info about production isn’t appealing in my view. Further more, REDIS_URL implies that your production environment just has a single Redis instance. Lots of deployments use several. So in short, I think this will make things a bit more complicated for people starting out and I think it wouldn’t be a good fit for a lot of real deployments anyway.

Thanks for taking the time to propose this, though! We should always be thinking about and questioning our choices.

Hello,

I have another use-case for this request.

My application is deployed several times as different apps in Heroku and elsewhere. Let’s say one is a staging app, another production. The only differences between the two is that they point to different resources, such as staging vs. production database, twilio account, etc. Now also Redis. Both applications are running in the production environment, so I can’t differentiate based on that in my redis.yml file. For all other resources, I’ve been able to use environment variables to point to different URLs for different instances of the application. For Redis, I can’t do that.

I agree that this is not a matter of security, and I agree that many users just want to put the URL in that config file, so I would certainly still allow that. But I’m sure I’m not the only one differentiating staging and production app resource by environment variable, and I think this would help lots of people.

Thanks,

  • Adam