secure_yaml 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -58,6 +58,7 @@ export PROPERTIES_ENCRYPTION_PASSWORD=abc12345678; ruby app.rb
58
58
 
59
59
  <strong>*** The value of the secret key must NOT be submitted to source control. Knowing the secret key allows a person to easily decrypt your properties.</strong>
60
60
  <br />
61
+ <br />
61
62
 
62
63
  <strong>4) Load and use the decrypted version of your YAML file within your app</strong>
63
64
 
@@ -1,5 +1,5 @@
1
1
  module SecureYaml
2
2
 
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
 
5
5
  end
data/lib/secure_yaml.rb CHANGED
@@ -15,6 +15,7 @@ module SecureYaml
15
15
  def self.secret_key(secret_key_prop_name)
16
16
  secret_key = ENV[secret_key_prop_name]
17
17
  raise "#{secret_key_prop_name} env property not found" if secret_key.nil?
18
+ secret_key
18
19
  end
19
20
 
20
21
  end
@@ -3,14 +3,16 @@ require 'spec_helper'
3
3
  describe 'SecureYaml' do
4
4
 
5
5
  before(:each) do
6
+ @secret_key = 'secret key'
6
7
  @yaml = {prop: 'test'}
7
8
  loader = double(SecureYaml::Loader)
8
9
  loader.stub(:load).and_return(@yaml)
9
- SecureYaml::Loader.stub(:new).and_return(loader)
10
+ SecureYaml::Loader.stub(:new).with(@secret_key).and_return(loader)
10
11
  end
11
12
 
12
13
  it 'should load decrypted yaml file' do
13
- ENV[SecureYaml::DEFAULT_SECRET_KEY_PROP_NAME] = 'secret key'
14
+
15
+ ENV[SecureYaml::DEFAULT_SECRET_KEY_PROP_NAME] = @secret_key
14
16
 
15
17
  yaml = SecureYaml::load(double(File))
16
18
 
@@ -25,7 +27,7 @@ describe 'SecureYaml' do
25
27
 
26
28
  it 'should allow use of custom secret key property name' do
27
29
  custom_secret_key_prop_name = 'CUSTOMER_SECRET_KEY_PROP_NAME'
28
- ENV[custom_secret_key_prop_name] = 'secret key'
30
+ ENV[custom_secret_key_prop_name] = @secret_key
29
31
 
30
32
  yaml = SecureYaml::load(double(File), custom_secret_key_prop_name)
31
33
 
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: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: