onboardbase 1.0.9 → 1.1.2
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.
- checksums.yaml +4 -4
- data/lib/onboardbase/version.rb +1 -1
- data/lib/onboardbase.rb +26 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b20b0f55bb8725e434cae52b693c7180d26c7ebb8b96512d1500044f862fe99e
|
4
|
+
data.tar.gz: 544a65582f129a37f765b8395c2e670fd9e2db121fc4e411296a34f2f46ee4ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb3675d2f4573d186470166feb6c5976ca2e7cb98d15447d85cd5d9fe02d3bc0873733045184fcf2f67ed7319737d39daa2e546b02a6ce0d28660b2233a7326a
|
7
|
+
data.tar.gz: 0e5df2e87355c4a83f7e73a4ec67535166838b34ff5b9c43a34438ae1cf8d8b7895d60e0da75fbfd32e24272261beb00d18d08d4c93c7fee379752f9dbe29ba8
|
data/lib/onboardbase/version.rb
CHANGED
data/lib/onboardbase.rb
CHANGED
@@ -246,10 +246,35 @@ module Onboardbase
|
|
246
246
|
JSON.parse(decoded_data)
|
247
247
|
end
|
248
248
|
|
249
|
+
def content_path
|
250
|
+
ENV["RAILS_ENV"] ? "config/credentials/#{ENV["RAILS_ENV"]}.yml.enc" : "config/credentials.yml.enc"
|
251
|
+
end
|
252
|
+
|
253
|
+
def key_path
|
254
|
+
ENV["RAILS_ENV"] ? "config/credentials/#{ENV["RAILS_ENV"]}.key" : "config/master.key"
|
255
|
+
end
|
256
|
+
|
257
|
+
def loadAsCredentials
|
258
|
+
# Traditionally fetch secrets into ENV
|
259
|
+
self.loadSecrets
|
260
|
+
require "active_support/encrypted_configuration"
|
261
|
+
credentials = ActiveSupport::EncryptedConfiguration.new(
|
262
|
+
config_path: self.content_path,
|
263
|
+
key_path: self.key_path,
|
264
|
+
env_key: "RAILS_MASTER_KEY",
|
265
|
+
raise_if_missing_key: true
|
266
|
+
)
|
267
|
+
|
268
|
+
secrets = YAML.load(credentials.read)
|
269
|
+
secrets.keys.sort.each do |key|
|
270
|
+
ENV["#{key}"] = "#{secrets[key]}"
|
271
|
+
end
|
272
|
+
credentials.write(ENV.to_hash.to_yaml)
|
273
|
+
end
|
274
|
+
|
249
275
|
def loadSecrets
|
250
276
|
self.loadConfig
|
251
277
|
response = self.parseResponse?(self.makeRequest)
|
252
|
-
p response
|
253
278
|
if response[:error]
|
254
279
|
puts "Unable to fetch secrets with the specified api key, reading from fallback file"
|
255
280
|
secrets = self.readFallback
|