secrets-manager 1.0.2 → 1.1.0

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: 7734a889392cc73aa54e40a7c4f2d74e7e929afde2e5bf31686e5c53a765b1a3
4
- data.tar.gz: '030684be36652a62e7d061362755f4ea1d5fb5bc4f431133ae457d5a6e2a89bb'
3
+ metadata.gz: e2b0d411d4b02fbf654e3ce1c1bb115a60bf79959ef61d4cecf0544080a6e98b
4
+ data.tar.gz: 2a28ded8d96b02b05d1785241edaf7164dc9bc7717ddcd76e1e0c0a32a2fbbb3
5
5
  SHA512:
6
- metadata.gz: cda099466f5f34e724dc9254341228d1373cca63abf702ded99bf3097710966ab53ba0eb91bc509c9a033ce59596a1e8d29352a838bc646fc4547c9b46e2e2ff
7
- data.tar.gz: 4b340ec39e04948f2d6098217773cb264a324d1b1eee40a3f5a590a480c6cfcdcf60e554295c2c2937277347a3bfec513eb9a6fb4b3e7ffa4bf0c417480ae0f1
6
+ metadata.gz: bda94c9cea1d22489136d8c66b70f4f8850082b6bbc79fd02c74d07ddbe8cd1ea93193d8eeb34abd313cc91690d08fcc368a076c317c11b0a43c5a03feb6eddd
7
+ data.tar.gz: e56f535dcfb61284c88d4e4690e901a7d4d9a71e473ddf81f92b6a154de610814d7c0cea42b7e5c0ec0b622749b3d5886c5852d4830741928cb1d4753b93a804
@@ -0,0 +1,3 @@
1
+ # 1.1.0
2
+ * Added support for parsing secrets encoded as JSON.
3
+ * Added support for scoping a secret to `global` prefix that will disregard env.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- secrets-manager (1.0.2)
4
+ secrets-manager (1.1.0)
5
5
  aws-sdk-secretsmanager (>= 1.31.0)
6
6
  concurrent-ruby (>= 1.0)
7
7
 
@@ -9,18 +9,18 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  aws-eventstream (1.0.3)
12
- aws-partitions (1.214.0)
13
- aws-sdk-core (3.68.0)
12
+ aws-partitions (1.276.0)
13
+ aws-sdk-core (3.90.1)
14
14
  aws-eventstream (~> 1.0, >= 1.0.2)
15
- aws-partitions (~> 1.0)
15
+ aws-partitions (~> 1, >= 1.239.0)
16
16
  aws-sigv4 (~> 1.1)
17
17
  jmespath (~> 1.0)
18
- aws-sdk-secretsmanager (1.31.0)
19
- aws-sdk-core (~> 3, >= 3.61.1)
18
+ aws-sdk-secretsmanager (1.33.0)
19
+ aws-sdk-core (~> 3, >= 3.71.0)
20
20
  aws-sigv4 (~> 1.1)
21
21
  aws-sigv4 (1.1.0)
22
22
  aws-eventstream (~> 1.0, >= 1.0.2)
23
- concurrent-ruby (1.1.5)
23
+ concurrent-ruby (1.1.6)
24
24
  diff-lcs (1.3)
25
25
  jmespath (1.4.0)
26
26
  rake (10.5.0)
@@ -48,4 +48,4 @@ DEPENDENCIES
48
48
  secrets-manager!
49
49
 
50
50
  BUNDLED WITH
51
- 2.0.2
51
+ 2.1.4
data/README.md CHANGED
@@ -33,6 +33,7 @@ For example, to access the secret `twlio-key`, `$secrets.fetch('twilio-key')`. T
33
33
  This gem expects your secret value to be a JSON object. The only required key is `value`. The following keys are optional:
34
34
  * `ttl` - Time to live in seconds. Describes how long the secret should live in in-memory cache.
35
35
  * `encoding` - Currently, only `base64` is supported as a value. If your `value` is base64 encoded, this will result in a returned secret that is base64 decoded.
36
+ * `type` - Currently, only `json` is supported as a value. If your `value` is valid JSON, this will result in a returned secret that is symbolified ruby hash.
36
37
 
37
38
  Example:
38
39
  ```
@@ -60,6 +61,11 @@ $secrets.fetch('services/twilio/api-key')
60
61
  $secrets['services/twilio/api-key']
61
62
  ```
62
63
 
64
+ To use a secret that is available in all envs, prepend the secret name with `global`
65
+ ```
66
+ $secrets['global/config/api-key']
67
+ ```
68
+
63
69
  ## Development
64
70
 
65
71
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -56,7 +56,11 @@ module SecretsManager
56
56
  end
57
57
 
58
58
  def fetch(secret_path)
59
- resolved_path = secret_env + '/' + secret_path
59
+ if secret_path.start_with?("global")
60
+ resolved_path = secret_path
61
+ else
62
+ resolved_path = secret_env + '/' + secret_path
63
+ end
60
64
 
61
65
  cached_value = cache.find(resolved_path)
62
66
  return cached_value if cached_value
@@ -93,6 +97,13 @@ module SecretsManager
93
97
  end
94
98
  end
95
99
 
100
+ if data[:type].present?
101
+ case data[:type]
102
+ when "json"
103
+ value = JSON.parse(value, symbolize_names: true)
104
+ end
105
+ end
106
+
96
107
  return value
97
108
  end
98
109
 
@@ -1,3 +1,3 @@
1
1
  module SecretsManager
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secrets-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Ostrowski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-09-17 00:00:00.000000000 Z
13
+ date: 2020-08-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: concurrent-ruby