Permalink
Browse files

Connecting to redis on boot

  • Loading branch information...
1 parent abca27f commit 8ec727960e15e1d760faee5e68c009e4bf007c87 @winton committed Aug 27, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/gem_template/boot/redis.rb
View
9 lib/gem_template/boot/redis.rb
@@ -8,8 +8,9 @@ def redis
yaml = YAML.load(File.read('config/redis.yml'))[env]
db = yaml.keys.first
config = yaml[db]
- config['db'] = db
- url = URI("redis://#{config['host']}:#{config['port']}/#{config['db']}")
+ config['db'] = db
+ $redis_url = "#{config['host']}:#{config['port']}/#{config['db']}"
+ url = URI("redis://#{$redis_url}")
::Redis.new(
:host => url.host,
@@ -18,4 +19,6 @@ def redis
:password => url.password
)
)
-end
+end
+
+redis

0 comments on commit 8ec7279

Please sign in to comment.