Created
December 12, 2012 12:59
-
-
Save DevL/4267523 to your computer and use it in GitHub Desktop.
Rake task for connecting to Redis on Heroku. Replace OPENREDIS_URL with whatever environment variable contains Redis connection string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Connect to Redis (production)' | |
task :redis do | |
redis_uri = `heroku config:get OPENREDIS_URL` | |
pattern = /redis:\/\/:(\S+)@(\S+):(\d+)/ | |
redis_uri[pattern] | |
command = "redis-cli -a #{$1} -h #{$2} -p #{$3}" | |
exec command | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment