secrets-manager 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +8 -8
- data/README.md +6 -0
- data/lib/secrets-manager.rb +12 -1
- data/lib/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: e2b0d411d4b02fbf654e3ce1c1bb115a60bf79959ef61d4cecf0544080a6e98b
|
4
|
+
data.tar.gz: 2a28ded8d96b02b05d1785241edaf7164dc9bc7717ddcd76e1e0c0a32a2fbbb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda94c9cea1d22489136d8c66b70f4f8850082b6bbc79fd02c74d07ddbe8cd1ea93193d8eeb34abd313cc91690d08fcc368a076c317c11b0a43c5a03feb6eddd
|
7
|
+
data.tar.gz: e56f535dcfb61284c88d4e4690e901a7d4d9a71e473ddf81f92b6a154de610814d7c0cea42b7e5c0ec0b622749b3d5886c5852d4830741928cb1d4753b93a804
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
secrets-manager (1.0
|
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.
|
13
|
-
aws-sdk-core (3.
|
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.
|
19
|
-
aws-sdk-core (~> 3, >= 3.
|
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.
|
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.
|
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.
|
data/lib/secrets-manager.rb
CHANGED
@@ -56,7 +56,11 @@ module SecretsManager
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def fetch(secret_path)
|
59
|
-
|
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
|
|
data/lib/version.rb
CHANGED
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
|
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:
|
13
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: concurrent-ruby
|