wes-cloudkit 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e718504b7784eadd1d4386d4f2c71029d50495bf
4
- data.tar.gz: a724d0f62b19939324c9da09d2e1d8f090e96860
3
+ metadata.gz: 30a7fa5c5b9630ce05afe3e1d946a332945700fd
4
+ data.tar.gz: 4a6cf985e6dd4138780c49cbcb77b687c16201ba
5
5
  SHA512:
6
- metadata.gz: 832bc556f234fc67544f6a6c91a999bb3e5c2a91bb07b4870bd5cf1d7d910885706af158344b2a406d689e3e7cfdef2cd9f59fa50fea118882caf4d1e77fdce9
7
- data.tar.gz: 52aaa6aa97cd332d1eff8abd220f6a917c49e7a5e0bb2409b20cdc612f7a64162b2dbef1010e370f6ab652b5a5886e8f04597043dbc0c5dbd27140c92d4cc289
6
+ metadata.gz: 335f6c72ca3250622aba1512fa2f2f8b16e929493f4e9fb221460fb605f3b7388a58bff75fcc70c610d378b4c588736be2cb8ee36e108027260ed119d7c324bb
7
+ data.tar.gz: 705b7ba8ca6128fd976c331ea4b19b9c2d8625660ec8b1cb2ac93ea1379e083baf922d99bf2d5a252336a0c3c9d89c8b387ad9137d5a38cc4831cc01b03b1bbd
@@ -1,6 +1,5 @@
1
- require "json"
2
- require "ostruct"
3
- require "Wes/cloudkit/configuration"
1
+ require "gibberish"
2
+ require "wes/cloudkit/configuration"
4
3
 
5
4
  module Wes
6
5
  module Cloudkit
@@ -21,12 +20,25 @@ module Wes
21
20
 
22
21
  attr_reader :json
23
22
 
23
+ def aws_env
24
+ configuration.aws_env
25
+ end
26
+
27
+ def cipher
28
+ @cipher ||= Gibberish::AES.new encyption_key
29
+ end
30
+
24
31
  def configuration
25
32
  Configuration
26
33
  end
27
34
 
28
- def aws_env
29
- configuration.aws_env
35
+ def decrypt(v)
36
+ cipher.decrypt v
37
+ end
38
+
39
+ def encyption_key
40
+ return "batman" unless Configuration.env == "production"
41
+ ENV["CONFIG_ENCRYPTION_KEY"]
30
42
  end
31
43
 
32
44
  def path
@@ -37,12 +49,22 @@ module Wes
37
49
 
38
50
  def parse
39
51
  OpenStruct.new(
40
- JSON.parse(
41
- File.read(path)
42
- )
52
+ raw_json.tap do |rj|
53
+ rj.keys.each do |node|
54
+ rj[node].keys.each do |key|
55
+ if rj[node][key]["secure"] == true
56
+ rj[node][key]["value"] = decrypt rj[node][key]["value"]
57
+ end
58
+ end
59
+ end
60
+ end
43
61
  )
44
62
  end
45
63
 
64
+ def raw_json
65
+ JSON.parse File.read(path)
66
+ end
67
+
46
68
  def root
47
69
  configuration.root
48
70
  end
@@ -7,7 +7,7 @@ module Wes
7
7
  attr_accessor :namespace, :root
8
8
 
9
9
  def app_config
10
- @app_config = AppConfig.new
10
+ @@app_config = AppConfig.new
11
11
  end
12
12
 
13
13
  def aws_env
@@ -1,5 +1,5 @@
1
1
  module Wes
2
2
  module Cloudkit
3
- VERSION = "1.0.0".freeze
3
+ VERSION = "2.0.0".freeze
4
4
  end
5
5
  end
data/wes-cloudkit.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rspec", "~> 3.0"
23
23
 
24
24
  spec.add_dependency "aws-sdk", "~> 2"
25
+ spec.add_dependency "gibberish", "~> 2"
25
26
  spec.add_dependency "json"
26
27
  spec.add_dependency "pry"
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wes-cloudkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: gibberish
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: json
71
85
  requirement: !ruby/object:Gem::Requirement