Skip to content

Instantly share code, notes, and snippets.

@jsloyer
Created March 4, 2015 14:40
Show Gist options
  • Save jsloyer/64cc5a5421b071b0bc06 to your computer and use it in GitHub Desktop.
Save jsloyer/64cc5a5421b071b0bc06 to your computer and use it in GitHub Desktop.
require 'resque/status_server'
require 'json'
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
if rails_env != "production"
Resque.redis = resque_config[rails_env]
else
vcap_services = JSON.parse(ENV['VCAP_SERVICES'])
credentials = vcap_services["rediscloud"][0]["credentials"]
Resque.redis = ":" + credentials["password"] + "@" + credentials["hostname"] + ":" + credentials["port"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment