2
votes

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?

1
Are you looking for this: export REDISTOGO_URL='redis://username:[email protected]:6389' ? - Brian
I'm sorry for the late response; it's because of the timezone. No, I want to create an actual connection from the commandline. I'm trying to setup sidekiq, and I think there's a command(maybe redis-server or so) to create a connection that can be used by sidekiq in development. - Chib

1 Answers

3
votes

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.