RedisEnvConfig

Provides redis client configuration based on environment variables:

  • REDIS_URL - standard Redis URL understood by the redis gem.
  • REDIS_CERT - PEM-encoded client certificate with which to connect to redis (required if REDIS_URL begins with rediss:)
  • REDIS_KEY - PEM-encoded client key with which to connect to redis (required if REDIS_URL begins with rediss:)
  • REDIS_CA_FILE - Path to file containing PEM-encoded CA certificate with which to validate server certificate (required if REDIS_URL begins with rediss:)
  • REDIS_CA - PEM-encoded CA certificate with which to validate server certificate (if present, content is written to REDIS_CA_FILE, if that file does not yet exist)

Installation

Add this line to your application's Gemfile:

gem 'redis_env_config'

And then execute:

$ bundle

Or install it yourself as:

$ gem install redis_env_config

Usage

require "redis"
require "redis_env_config"

redis = Redis.new(RedisEnvConfig.new.to_h)

Development

After checking out the repo, run docker-compose build && docker-compose run test to run the tests.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/webnifico/redis_env_config.

License

The gem is available as open source under the terms of the MIT License.