simple_parameter_store 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2dc9f14a795d916ad62a2e0bc0c856af6f8ab1e50dc3e33e952b35334cb34d2
4
- data.tar.gz: ffa943b5a34efac86836b506e40560b9bf3bc7c4fde5ccaeb96f5822db02fba2
3
+ metadata.gz: 0071e4ef3cd71ae0a57df53926b5a7f2fbd5a7f20e1c6d68eefa895d508cb39b
4
+ data.tar.gz: f128adff7f525f097cd0e5f04c8cfa6c89779aed514efc3b7515a5ff1804b4c4
5
5
  SHA512:
6
- metadata.gz: c793cdc5b16b1bed1b5f801fb5277a47848326c288191588fa16f6a21dd05debdd1d1fdf9e870c2225cecf4d55a48e493835ce13ffa692708d10201c8d6c235b
7
- data.tar.gz: 4faa3f5f51d78c6c2b8f0dc385990efe021a741a92333fb458413cc283dcc4209e0ddc550752dd3131e1cc097c91df189f226acb82ed0befee4fda95c2d6b231
6
+ metadata.gz: 656371046a106f78f958de51bbdbd83d43507947273068c12bfbd11530aafff57415a51594312a8c829736d3d9ff118d2aefb4bcd4b819ecfffe983ce6846b66
7
+ data.tar.gz: cfd9696da27b114efabdfaea1d88e436d0c3826b0b9b9c6c97c8cfb7f1dafc0df1f4a2a90a87e9bc62d08a437e6dd3dc4e4594e841aae55c4b46ec7ee1221c42
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_parameter_store (0.1.0)
4
+ simple_parameter_store (0.1.1)
5
5
  aws-sdk-ssm
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SimpleParameterStore
2
2
 
3
- `SimpleParameterStore` gives you an nice abstraction over the AWS SSM Parameter Store.
3
+ `SimpleParameterStore` gives you a nice abstraction over the AWS SSM Parameter Store.
4
4
 
5
5
  ## Installation
6
6
 
@@ -25,13 +25,13 @@ require 'simple_parameter_store'
25
25
 
26
26
  parameters = SimpleParameterStore.new(
27
27
  client: Aws::SSM::Client.new, # optional, default: `Aws::SSM::Client.new`, can be used to set custom args for the SSM client
28
- prefix: "/#{ENV['ENVIRONMENT']}", # optional, default: `nil`, can be used to prefix all parameter names with `/production`
29
- expires_after: 3600, # optional, default: `nil`, time in seconds after the store will be refreshed
30
- decryp: true, # optional, default: `true`, enable/disable automatic parameter decryption
31
- names: { # requires, hash with mapping of parameter names, the key will be used for the store index
32
- foo: '/bar', # aliased the key `/bar` (if prefix is `nil`) under the `:foo` in the store
28
+ prefix: "/#{ENV['ENVIRONMENT']}", # optional, default: `nil`, can be used to prefix all parameter names (e.g. with `/production`)
29
+ expires_after: 3600, # optional, default: `nil`, time in seconds after which the store will be refreshed
30
+ decrypt: true, # optional, default: `true`, enable/disable automatic parameter decryption
31
+ names: { # required; hash with mapping of parameter names, the key will be used for the store index
32
+ foo: '/bar', # aliases the key `/bar` (if prefix is `nil`) as `:foo` in the store
33
33
  max: ['max', :to_i.to_proc], # the value can be an array with the key as first and a caster as second value,
34
- key: ['private_key', OpenSSL::PKey::RSA.method(:new)] # the caster must be respond to `call` and return the converted value
34
+ key: ['private_key', OpenSSL::PKey::RSA.method(:new)] # the caster must respond to `call` and return the converted value
35
35
  }
36
36
  )
37
37
 
@@ -39,8 +39,8 @@ parameters[:foo] # => `'bar'`
39
39
  parameters[:max] # => `123`
40
40
  parameters[:key].class # => OpenSSL::PKey::RSA
41
41
 
42
- parameters.refresh # forces an store refresh
43
- parameters.refresh_if_needed # refreshes the store is expired
42
+ parameters.refresh # forces a store refresh
43
+ parameters.refresh_if_needed # refreshes if the store is expired
44
44
  ```
45
45
 
46
46
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SimpleParameterStore
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'simple_parameter_store/version'
4
+ require 'aws-sdk-ssm'
4
5
 
5
6
  class SimpleParameterStore
6
7
  class SSMKeyError < KeyError; end
@@ -15,7 +16,7 @@ class SimpleParameterStore
15
16
  @casters = {}
16
17
  @cache = {}
17
18
 
18
- prepaire(names)
19
+ prepare(names)
19
20
  refresh
20
21
  end
21
22
 
@@ -49,12 +50,12 @@ class SimpleParameterStore
49
50
 
50
51
  def fetch
51
52
  result = client.get_parameters(names: @mappings.values, with_decryption: decrypt)
52
- raise SSMKeyError if result.invalid_parameters.any?
53
+ raise SSMKeyError, "Missing keys: `#{result.invalid_parameters}`" if result.invalid_parameters.any?
53
54
 
54
55
  result
55
56
  end
56
57
 
57
- def prepaire(names)
58
+ def prepare(names)
58
59
  names.each_pair do |key, (name, caster)|
59
60
  @mappings[key] = "#{prefix}#{name}"
60
61
  @casters[key] = caster || :itself.to_proc
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_parameter_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Schilling