mach 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mach/configuration.rb +2 -1
- data/lib/mach/persistence/redis_store.rb +5 -3
- data/lib/mach/version.rb +1 -1
- metadata +2 -2
data/lib/mach/configuration.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'mach/persistence/in_memory_store'
|
2
2
|
require 'mach/persistence/redis_store'
|
3
3
|
require 'base64'
|
4
|
+
require 'logger'
|
4
5
|
|
5
6
|
module Mach
|
6
7
|
class Configuration
|
@@ -12,7 +13,7 @@ module Mach
|
|
12
13
|
@data_store = Mach::Persistence::InMemoryStore.configure({})
|
13
14
|
@credential_store = Hash.new
|
14
15
|
@ignore_validation_failure = false
|
15
|
-
@logger = Logger.new(STDOUT)
|
16
|
+
@logger = ::Logger.new(STDOUT)
|
16
17
|
end
|
17
18
|
|
18
19
|
def with_credential_store(store, options = {})
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'mach/error/error'
|
1
2
|
require 'mach/persistence/delta_and_nonce_store'
|
2
3
|
require 'mach/timestamp'
|
3
4
|
require 'redis'
|
@@ -6,8 +7,9 @@ module Mach
|
|
6
7
|
module Persistence
|
7
8
|
class RedisStore < Mach::Persistence::DeltaAndNonceStore
|
8
9
|
def initialize(options = {})
|
9
|
-
raise MissingConfigurationOptionError unless options[:host] && options[:port]
|
10
|
+
raise Mach::Error::MissingConfigurationOptionError unless options[:host] && options[:port]
|
10
11
|
@redis = Redis.new(:host => options[:host], :port => options[:port])
|
12
|
+
@key_namespace = options[:key_namespace] || ""
|
11
13
|
end
|
12
14
|
|
13
15
|
def find_delta_by(credential_id)
|
@@ -29,11 +31,11 @@ module Mach
|
|
29
31
|
|
30
32
|
private
|
31
33
|
def delta_key_for(credential_id)
|
32
|
-
"delta_key_for_#{credential_id}"
|
34
|
+
"#{@key_namespace}delta_key_for_#{credential_id}"
|
33
35
|
end
|
34
36
|
|
35
37
|
def nonce_key_for(credential_id, nonce)
|
36
|
-
"nonce_key_for_#{credential_id}_#{nonce}"
|
38
|
+
"#{@key_namespace}nonce_key_for_#{credential_id}_#{nonce}"
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
data/lib/mach/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|