simple_parameter_store 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/lib/simple_parameter_store.rb +4 -4
- data/lib/simple_parameter_store/mock.rb +2 -10
- data/lib/simple_parameter_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcfb91829da93dc3fba46791a808a891ceed8e8806331ae6eee052b80987a394
|
4
|
+
data.tar.gz: 82e5b470b4806c02e6b745446cf95734424abd5c7aba86b4407519c66c2ed5ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c380e14e2155aa87480c32c8e32a86d62aa55649cfc1061e8d7843359ed25ccc544c70c9cc779363e26d791eb404376048ba33159f77a4762d16644ff0f7070
|
7
|
+
data.tar.gz: 6700dc6cb2e488fe5636663d9bdb0eff3a79205f03fbfe897bb8fe4ec01df5e476dd26f83d8cccacef780d6f8453a3f06817459905b9abde6506cc0bd5bfa76b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -23,12 +23,12 @@ GIT
|
|
23
23
|
PATH
|
24
24
|
remote: .
|
25
25
|
specs:
|
26
|
-
simple_parameter_store (0.2.
|
26
|
+
simple_parameter_store (0.2.1)
|
27
27
|
aws-sdk-ssm
|
28
28
|
|
29
29
|
GEM
|
30
30
|
remote: https://rubygems.org/
|
31
|
-
remote: https://6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev/
|
31
|
+
remote: https://oss:6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev/
|
32
32
|
specs:
|
33
33
|
abstract_type (0.0.7)
|
34
34
|
adamantium (0.2.0)
|
@@ -24,10 +24,10 @@ class SimpleParameterStore
|
|
24
24
|
attr_reader :client, :prefix, :decrypt, :expires_after, :expires_at
|
25
25
|
|
26
26
|
def refresh
|
27
|
-
fetch.
|
28
|
-
key, = @mappings.rassoc(
|
27
|
+
fetch.each_pair do |name, value|
|
28
|
+
key, = @mappings.rassoc(name)
|
29
29
|
caster = @casters.fetch(key)
|
30
|
-
value = caster.call(
|
30
|
+
value = caster.call(value)
|
31
31
|
@cache[key] = value
|
32
32
|
end
|
33
33
|
|
@@ -53,7 +53,7 @@ class SimpleParameterStore
|
|
53
53
|
result = client.get_parameters(names: @mappings.values, with_decryption: decrypt)
|
54
54
|
raise SSMKeyError, "Missing keys: `#{result.invalid_parameters}`" if result.invalid_parameters.any?
|
55
55
|
|
56
|
-
result.parameters
|
56
|
+
result.parameters.map { |parameter| [parameter.name, parameter.value] }.to_h
|
57
57
|
end
|
58
58
|
|
59
59
|
def prepare(names)
|
@@ -4,14 +4,6 @@ class SimpleParameterStore
|
|
4
4
|
module Mock
|
5
5
|
class MockError < StandardError; end
|
6
6
|
|
7
|
-
class Parameter
|
8
|
-
attr_reader :name, :value
|
9
|
-
def initialize(name, value)
|
10
|
-
@name = name
|
11
|
-
@value = value
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
7
|
def self.prepended(base)
|
16
8
|
base.extend ClassMethods
|
17
9
|
end
|
@@ -22,7 +14,7 @@ class SimpleParameterStore
|
|
22
14
|
%i[prefix decrypt expires_after client].each do |key|
|
23
15
|
current_value = instance_variable_get("@#{key}")
|
24
16
|
expected_value = self.class.mock.fetch(key)
|
25
|
-
raise MockError, <<~ERROR unless current_value.
|
17
|
+
raise MockError, <<~ERROR unless current_value.eql?(expected_value)
|
26
18
|
Invalid `:#{key}`:
|
27
19
|
expected: `#{expected_value}`
|
28
20
|
current: `#{current_value}`
|
@@ -45,7 +37,7 @@ class SimpleParameterStore
|
|
45
37
|
|
46
38
|
def mock=(names:, client: nil, prefix: nil, decrypt: true, expires_after: nil)
|
47
39
|
@mock = {
|
48
|
-
cache: names.
|
40
|
+
cache: names.transform_keys { |key| "#{prefix}#{key}" },
|
49
41
|
prefix: prefix,
|
50
42
|
decrypt: decrypt,
|
51
43
|
expires_after: expires_after,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_parameter_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Schilling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-ssm
|