Skip to content

Commit

Permalink
Pick up REDIS_URL in Redis::Client
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed May 9, 2012
1 parent 517e0fe commit 06b2a58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions lib/redis.rb
Expand Up @@ -10,8 +10,6 @@ def self.deprecate(message, trace = caller[0])
attr :client

def self.connect(options = {})
options = options.dup
options[:url] ||= ENV["REDIS_URL"]
new(options)
end

Expand Down
6 changes: 4 additions & 2 deletions lib/redis/client.rb
Expand Up @@ -299,11 +299,13 @@ def ensure_connected
def _parse_options(options)
defaults = DEFAULTS.dup

url = options[:url] || ENV["REDIS_URL"]

# Override defaults from URL if given
if options[:url]
if url
require "uri"

uri = URI(options[:url])
uri = URI(url)

if uri.scheme == "unix"
defaults[:path] = uri.path
Expand Down

0 comments on commit 06b2a58

Please sign in to comment.