secure_yaml 2.0.0 → 2.0.1
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.
- data/README.md +3 -1
- data/lib/secure_yaml/version.rb +1 -1
- data/lib/secure_yaml/yaml_decrypter.rb +1 -1
- data/spec/fixtures/test.yml +2 -2
- data/spec/integration/secure_yaml_spec.rb +2 -2
- metadata +2 -2
data/README.md
CHANGED
|
@@ -68,7 +68,9 @@ require 'secure_yaml'
|
|
|
68
68
|
decrypted_yaml = SecureYaml::load(File.open('database.yml'))
|
|
69
69
|
|
|
70
70
|
# Alternatively, to override the default secret key environmental property name:
|
|
71
|
-
decrypted_yaml = SecureYaml::load(File.open('database.yml'),
|
|
71
|
+
decrypted_yaml = SecureYaml::load(File.open('database.yml'), {
|
|
72
|
+
:secret_key_property_name => 'NEW_SECRET_KEY_PROPERTY_NAME'
|
|
73
|
+
})
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
<br />
|
data/lib/secure_yaml/version.rb
CHANGED
|
@@ -12,7 +12,7 @@ module SecureYaml
|
|
|
12
12
|
def decrypt(yaml)
|
|
13
13
|
case yaml
|
|
14
14
|
when Hash
|
|
15
|
-
yaml.inject({}) {|new_hash, (key, value)| new_hash[key
|
|
15
|
+
yaml.inject({}) {|new_hash, (key, value)| new_hash[key] = decrypt(value); new_hash}
|
|
16
16
|
when String
|
|
17
17
|
yaml.gsub(/^#{ENCRYPTED_PROPERTY_WRAPPER_ID}\((.*)\)$/) {@decryption_algorithm.decrypt(@secret_key, $1)}
|
|
18
18
|
else
|
data/spec/fixtures/test.yml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
plain_prop: "1234"
|
|
2
|
+
encrypted_prop: "ENC(EBnrEqmvC5BbOXw=)"
|
|
@@ -11,7 +11,7 @@ describe 'SecureYaml' do
|
|
|
11
11
|
it 'should load decrypted yaml file using default decryption algorithm' do
|
|
12
12
|
yaml = SecureYaml::load(@test_yaml_file)
|
|
13
13
|
|
|
14
|
-
yaml.should == {
|
|
14
|
+
yaml.should == {'plain_prop' => '1234', 'encrypted_prop' => 'secret-text'}
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'should load decrypted yaml file using custom decryption algorithm' do
|
|
@@ -23,7 +23,7 @@ describe 'SecureYaml' do
|
|
|
23
23
|
|
|
24
24
|
yaml = SecureYaml::load(@test_yaml_file, {:decryption_algorithm => custom_decryption_algorithm})
|
|
25
25
|
|
|
26
|
-
yaml.should == {
|
|
26
|
+
yaml.should == {'plain_prop' => '1234', 'encrypted_prop' => 'decrypted!'}
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: secure_yaml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-08-
|
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|