redis-sentinel-url 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/redis/sentinel/url.rb +13 -13
- data/lib/redis/sentinel/url/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 597faed5b262419e716b6f700b712ec5d67621607733c1956701c3a4a99215b5
|
4
|
+
data.tar.gz: cd8c90e51356a06de9a4214040195df552d13c294097e96037b8b78901f10b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578e543656da5d461a44d9f9f49b910574a8b5b72d2f613942e05ca307beb9ac9a5dd3900d64977f8b480ec2ab4757dc641ddec6f3398e1af27808d8ac7032c9
|
7
|
+
data.tar.gz: ca7c9deb2c48ec97e448fb808a5f0f84cab83c09c91bf6f55768c1aa347f54695fabb894794d19cf5b6f5526f9ee767a46a38de5dc0c544624a5b37787b9a262
|
data/README.md
CHANGED
@@ -18,7 +18,9 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
`require 'redis/sentinel/url'`
|
22
|
+
|
23
|
+
You can then use the following URL syntax in the `REDIS_URL` environment variable, or passed to `Redis.new(url: ...)`:
|
22
24
|
|
23
25
|
`redis+sentinel://host[:port][/service_name[/db]][?param1=value1[¶m2=value=2&...]]`
|
24
26
|
|
data/lib/redis/sentinel/url.rb
CHANGED
@@ -44,25 +44,25 @@ class Redis
|
|
44
44
|
uri_options
|
45
45
|
end
|
46
46
|
end
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
default_url = ::Redis::Client::DEFAULTS[:url]
|
53
|
-
default_url = default_url.call if default_url.respond_to?(:call)
|
49
|
+
module SentinelURLParser
|
50
|
+
def initialize(options = {})
|
51
|
+
return super unless options[:url]
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
options = options.merge(Redis::Sentinel::URL.parse(url))
|
58
|
-
end
|
53
|
+
default_url = ::Redis::Client::DEFAULTS[:url]
|
54
|
+
default_url = default_url.call if default_url.respond_to?(:call)
|
59
55
|
|
60
|
-
|
56
|
+
url = options[:url] || default_url
|
57
|
+
if url.to_s.start_with?('redis+sentinel://')
|
58
|
+
options = options.merge(Redis::Sentinel::URL.parse(url))
|
61
59
|
end
|
60
|
+
|
61
|
+
super(options)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
class ::Redis
|
67
|
-
prepend Redis::
|
66
|
+
class ::Redis
|
67
|
+
prepend Redis::SentinelURLParser
|
68
68
|
end
|