itamae-secrets 0.1.0 → 0.2.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 +4 -3
- data/lib/itamae/secrets/cli.rb +1 -1
- data/lib/itamae/secrets/keychain.rb +1 -1
- data/lib/itamae/secrets/store.rb +14 -2
- data/lib/itamae/secrets/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3189e0466cac90d11c20296d8087afaff2d411fc
|
4
|
+
data.tar.gz: 7afb09f3eccf8b2d19338666906b4584b0d3f08c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fef9daa15514dd1ecbb90df93e1e14231d3f06cd9ee1bae9d1e709ad28e8c91c12ee4c2173bf88f080bd6fa49443fa0cfc4612358f489b63f6ede6806f4782c1
|
7
|
+
data.tar.gz: 0b1e08af8e274d6439fdb17e762ed007daa848ce00f379374419fe00b723c2ae106352695d2e2d61a198528d3b12e8d3d879317749f3dda4f2357819c13c738d
|
data/README.md
CHANGED
@@ -17,8 +17,9 @@ $ gem install itamae-secrets
|
|
17
17
|
## Basic
|
18
18
|
|
19
19
|
- `itamae-secrets` command for storing data or manually reading
|
20
|
-
|
21
|
-
|
20
|
+
- `Itamae::Secrets` interface for itamae recipes
|
21
|
+
- Data are stored in _base directory._
|
22
|
+
- You must avoid `${base}/keys` from checked into VCS. (`.gitignore` it!)
|
22
23
|
|
23
24
|
## Walkthrough
|
24
25
|
|
@@ -58,7 +59,7 @@ node[:secrets] = Itamae::Secrets(File.join(__dir__, 'secrets'))
|
|
58
59
|
p node[:secrets][:awesome_secret]
|
59
60
|
```
|
60
61
|
|
61
|
-
### Reading data
|
62
|
+
### Reading data from CLI
|
62
63
|
|
63
64
|
```
|
64
65
|
$ itamae-secrets get --base=./secret awesome_secret
|
data/lib/itamae/secrets/cli.rb
CHANGED
@@ -27,7 +27,7 @@ module Itamae
|
|
27
27
|
passphrase = ask_noecho('Passphrase:', true)
|
28
28
|
AesKey.generate_pkcs5(name, passphrase)
|
29
29
|
else
|
30
|
-
raise ArgumentError, "Unknown method: #{
|
30
|
+
raise ArgumentError, "Unknown method: #{options[:method] || config['generate_method']}"
|
31
31
|
end
|
32
32
|
|
33
33
|
keychain.save(key)
|
data/lib/itamae/secrets/store.rb
CHANGED
@@ -27,7 +27,15 @@ module Itamae
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def [](name)
|
30
|
-
name
|
30
|
+
fetch(name, nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
def fetch(*args)
|
34
|
+
if args.size > 2
|
35
|
+
raise ArgumentError, "wrong number of arguments (#{args.size} for 1..2)"
|
36
|
+
end
|
37
|
+
|
38
|
+
name = args[0].to_s
|
31
39
|
validate_name!(name)
|
32
40
|
|
33
41
|
value_path = values_path.join(name)
|
@@ -37,7 +45,11 @@ module Itamae
|
|
37
45
|
encrypted_data.key = keychain.load(encrypted_data.key_name)
|
38
46
|
JSON.parse(encrypted_data.plaintext)['value']
|
39
47
|
else
|
40
|
-
|
48
|
+
if args.size == 1
|
49
|
+
raise KeyError, "key not found: #{name}"
|
50
|
+
else
|
51
|
+
args[1]
|
52
|
+
end
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itamae-secrets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Fukumori (sora_h)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.6.8
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Encrypted Data Bag for itamae
|