stefanwille / crystal-redis

Full featured Redis client for Crystal
MIT License
381 stars 61 forks source link

Support ENV["REDIS_URL"] out of the box #135

Open dup2 opened 10 months ago

dup2 commented 10 months ago

While reading the documentation for most other redis clients (in different languages) I found that the environment variable REDIS_URL is supported and being used out of the box for most implementation.

This helps in setting up CI jobs and container based environment as you do not have to call specific initialiser code in the project and for specs, mocking is much easier to achieve.

I see that at the moment the fallback is "hardcoded" to localhost:6379 via default parameter values. This would probably need a change in a way that they could be nil and then first ENV["REDIS_URL"] is checked and afterwards the fallback is "localhost:6379" as it is now.

What do you think about this?