sekreto 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/sekreto/config.rb +18 -1
- data/lib/sekreto/version.rb +1 -1
- data/lib/sekreto.rb +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef433a73a4b38041a6eda3ff98ac6b0cd696a8b081706a52ef2989f8914c113
|
4
|
+
data.tar.gz: f40316dd6e2c01a62858c3de990dd7a6b1b8f40eb6040601b10197187309d562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbc396f208a6689cc06be6d1d42f0f23309d794cb1542d979bff25962bff160003a089c9634160f6b9a2afa8bc5d97e400be102b9112834a7788432fc096a7e3
|
7
|
+
data.tar.gz: cc600feac613119f06ccdeb8c9502c55411bd610c6a69a6309308506490e2f7785aaf2080a26b14315d264c1fc1b4fea17aa3b4071de0580db4da5234005a55c
|
data/README.md
CHANGED
@@ -92,6 +92,16 @@ puts secret
|
|
92
92
|
# Output: { some: 'json', data: 'here' }
|
93
93
|
```
|
94
94
|
|
95
|
+
If you want to skip prefixes all together you can pas `false` to either
|
96
|
+
get value methods. **Not recommended**
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
# Will query for "shared-secrets/MY-SECRET-CONFIG"
|
100
|
+
secret = Sekreto.get_json_value('MY-SECRET-CONFIG', false)
|
101
|
+
puts secret
|
102
|
+
# Output: { some: 'json', data: 'here' }
|
103
|
+
```
|
104
|
+
|
95
105
|
## Development
|
96
106
|
|
97
107
|
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/sekreto/config.rb
CHANGED
@@ -4,6 +4,8 @@ module Sekreto
|
|
4
4
|
##
|
5
5
|
# Config class for setting up Sekreto for usage
|
6
6
|
class Config
|
7
|
+
DEFAULT_PREFIX = 'secrets'.freeze
|
8
|
+
|
7
9
|
attr_accessor :prefix
|
8
10
|
attr_accessor :is_allowed_env
|
9
11
|
attr_accessor :fallback_lookup
|
@@ -16,11 +18,26 @@ module Sekreto
|
|
16
18
|
#
|
17
19
|
# @return [Sekreto::Config]
|
18
20
|
def initialize
|
19
|
-
@prefix =
|
21
|
+
@prefix = DEFAULT_PREFIX
|
20
22
|
@is_allowed_env = -> { true }
|
21
23
|
@fallback_lookup = ->(secret_id) { ENV[secret_id] }
|
22
24
|
@secrets_manager = nil
|
23
25
|
@logger = Logger.new(STDOUT)
|
24
26
|
end
|
27
|
+
|
28
|
+
##
|
29
|
+
#
|
30
|
+
# Get the prefix name to use when looking up secrets
|
31
|
+
#
|
32
|
+
# @param prefix_path [String,NilClass,FalseClass] - The path to use for the prefix
|
33
|
+
#
|
34
|
+
# @return [String] prefix path
|
35
|
+
#
|
36
|
+
# @example If a nil is passed it defaults to the config.prefix.
|
37
|
+
# When a false is passed then no prefix is used. (Not recommended)
|
38
|
+
def prefix_name(prefix_path = nil)
|
39
|
+
return nil if prefix_path == false
|
40
|
+
prefix_path || prefix
|
41
|
+
end
|
25
42
|
end
|
26
43
|
end
|
data/lib/sekreto/version.rb
CHANGED
data/lib/sekreto.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sekreto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Autolist Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-secretsmanager
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.2.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|