lib/boom/storage/redis.rb in boom-0.2.3 vs lib/boom/storage/redis.rb in boom-0.2.4

- old
+ new

@@ -3,19 +3,24 @@ # Sup, Redis. # begin require 'digest' require 'redis' + require 'uri' rescue LoadError end module Boom module Storage class Redis < Base def redis - @redis ||= ::Redis.new :host => Boom.config.attributes["redis"]["host"], - :port => Boom.config.attributes["redis"]["port"] + uri = URI.parse(Boom.config.attributes['uri'] || '') + + @redis ||= ::Redis.new :host => (uri.host || Boom.config.attributes["redis"]["host"]), + :port => (uri.port || Boom.config.attributes["redis"]["port"]), + :user => (uri.user || Boom.config.attributes["redis"]["user"]), + :password => (uri.password || Boom.config.attributes["redis"]["password"]) rescue NameError => e puts "You don't have Redis installed yet:\n gem install redis" exit end