Reputation: 53
in order to use RedisToGo on development, I need to set the environment variable as follows: ENV["REDISTOGO_URL"] = 'redis://username:[email protected]:6389'
How can I create a redis connection with the username, password and my.host setting, assuming I already have redis-server installed? I think there's a commandline command I have used to achieve this before but I can't seem to remember it now and I can't find any information on this online. Suggestions?
Upvotes: 3
Views: 1940
Reputation: 11509
My setup is similar and uses the following:
# config/initializers/redis.rb
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(host: uri.host, port: uri.port, password: uri.password)
development & test environments:
ENV['REDISTOGO_URL'] = 'redis:://@localhost:6379'
And then you don't need to set anything for production as long as you have the gem and RedisToGo installed on your Heroku instance.
Upvotes: 3