hiera-redis 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,23 +2,22 @@ class Hiera
2
2
  module Backend
3
3
  class Redis_backend
4
4
 
5
- VERSION="0.1.2"
5
+ VERSION="0.1.3"
6
6
 
7
7
  def initialize
8
8
 
9
9
  require 'redis'
10
10
  Hiera.debug("Hiera Redis backend starting")
11
11
 
12
- # better error checking needed here?
13
- path = Config[:redis][:path]
14
- port = Config[:redis][:port] || 6379
15
- host = Config[:redis][:host] || '127.0.0.1'
16
-
17
- if path.nil?
18
- @r = Redis.new(:host => host, :port => port)
19
- else
20
- @r = Redis.new(:path => path)
12
+ # default values
13
+ options = {:host => 'localhost', :port => 6379, :db => 0, :password => nil, :timeout => 3, :path => nil}
14
+
15
+ # config overrides default values
16
+ options.each_key do |k|
17
+ options[k] = Config[:redis][k] if Config[:redis].has_key?(k)
21
18
  end
19
+
20
+ @r = Redis.new(options)
22
21
  end
23
22
 
24
23
  def lookup(key, scope, order_override, resolution_type)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-redis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Kosmin c/o Reliant Security, Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-08 00:00:00 Z
18
+ date: 2012-03-12 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Allows hiera functions to pull data from a Redis database.