canzea 0.1.112 → 0.1.113
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canzea/version.rb +1 -1
- data/lib/registry.rb +21 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9ca2c10d1d784bdbeec96f575c11ba4b7bb461
|
4
|
+
data.tar.gz: 6ca457e117a47cc0ab0db3e3fd95030cab36176a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36312019452e3067a896dc4d7909f45bf4e683b9dc6e78651e710ed7a01170289bebe20f1278356a401b916373905637a153b3428c5197e11a642d6390f9a66
|
7
|
+
data.tar.gz: 7ad1e7e0e6d5f1724d505a3f135dd47cc1053e98dbc35b26a78d79f191f8ed40bcc9fc8a70e2a8938012ba824e449a7277c47461dc8f9218f745e3982e96db5e
|
data/lib/canzea/version.rb
CHANGED
data/lib/registry.rb
CHANGED
@@ -104,7 +104,7 @@ class Registry
|
|
104
104
|
def getSecret (key)
|
105
105
|
|
106
106
|
uri = URI.parse(ENV["VAULT_URL"] + "/v1/secret/#{key}")
|
107
|
-
http =
|
107
|
+
http = prepareHttpForVault(uri)
|
108
108
|
|
109
109
|
request = Net::HTTP::Get.new(uri.request_uri)
|
110
110
|
request['X-Vault-Token'] = ENV["VAULT_TOKEN"]
|
@@ -120,7 +120,7 @@ class Registry
|
|
120
120
|
def setSecret (key, value)
|
121
121
|
|
122
122
|
uri = URI.parse(ENV["VAULT_URL"] + "/v1/secret/#{key}")
|
123
|
-
http =
|
123
|
+
http = prepareHttpForVault(uri)
|
124
124
|
|
125
125
|
request = Net::HTTP::Put.new(uri.request_uri)
|
126
126
|
request['Content-Type'] = 'application/json'
|
@@ -153,4 +153,23 @@ class Registry
|
|
153
153
|
return http
|
154
154
|
end
|
155
155
|
|
156
|
+
def prepareHttpForVault (uri)
|
157
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
158
|
+
|
159
|
+
if (Canzea::config[:consul_tls])
|
160
|
+
pemCert = File.read(Canzea::config[:vault_tls_cert_file])
|
161
|
+
pemKey = File.read(Canzea::config[:vault_tls_key_file])
|
162
|
+
|
163
|
+
http.use_ssl = true
|
164
|
+
http.ca_file = Canzea::config[:consul_tls_ca_file]
|
165
|
+
http.cert = OpenSSL::X509::Certificate.new(pemCert)
|
166
|
+
http.key = OpenSSL::PKey::RSA.new(pemKey)
|
167
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
168
|
+
# http.set_debug_output($stdout)
|
169
|
+
http.ssl_version = :SSLv23
|
170
|
+
end
|
171
|
+
|
172
|
+
return http
|
173
|
+
end
|
174
|
+
|
156
175
|
end
|