lib/lemondrop/plugin/service.rb in lemondrop-0.1.1 vs lib/lemondrop/plugin/service.rb in lemondrop-0.1.2

- old
+ new

@@ -8,15 +8,15 @@ ## # Start the Redis connection with the configured database def start(config) params = config.to_hash.select { |k,v| !v.nil? } unless params[:uri].nil? || params[:uri].empty? - redis_uri = URI.parse params[:uri] - params[:user] = redis_uri.user - params[:password] = redis_uri.password - params[:host] = redis_uri.host - params[:port] = redis_uri.port || params[:port] + uri = URI.parse params[:uri] + params[:username] = uri.user + params[:password] = uri.password + params[:hostname] = uri.hostname + params[:port] = uri.port || params[:port] params.delete :uri end @@connection = establish_connection params end @@ -30,11 +30,12 @@ ## # Start the connection to the configured Redis server # # @param params [Hash] Options to establish the Redis connection def establish_connection(params) + connection = ::Redis.new params logger.info "Lemondrop connected to Redis at #{params[:host]}:#{params[:port]}" - ::Redis.new params + connection end end # class << self end # Service