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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3da378a9bdfe249b7e2e997a17c8a9a58fc32c86996161e1396dc2f938f104c9
4
- data.tar.gz: f70dfaadd815bb5262f0f1e0fc48642dc044795d3b46a20c2523e0af175fa41b
3
+ metadata.gz: b20b0f55bb8725e434cae52b693c7180d26c7ebb8b96512d1500044f862fe99e
4
+ data.tar.gz: 544a65582f129a37f765b8395c2e670fd9e2db121fc4e411296a34f2f46ee4ad
5
5
  SHA512:
6
- metadata.gz: dde86f766f8219e44137c8345d60fc58bf9d43cbf44bd5aa16689e1e8e16eb0a2a275e48546865609b296735e461accc8c7108bc9b57fe9dac12f9f1873c7174
7
- data.tar.gz: 6e3ff821a6a2723c8626d74aeab4e5eb247a31eede468da4c23381ffba0ee33910572f15dc54a76b5a7886f6c29031141df9b707b831e3ee325995dcbeb6bbeb
6
+ metadata.gz: cb3675d2f4573d186470166feb6c5976ca2e7cb98d15447d85cd5d9fe02d3bc0873733045184fcf2f67ed7319737d39daa2e546b02a6ce0d28660b2233a7326a
7
+ data.tar.gz: 0e5df2e87355c4a83f7e73a4ec67535166838b34ff5b9c43a34438ae1cf8d8b7895d60e0da75fbfd32e24272261beb00d18d08d4c93c7fee379752f9dbe29ba8
@@ -1,3 +1,3 @@
1
1
  module Onboardbase
2
- VERSION = '1.0.9'
2
+ VERSION = '1.1.2'
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onboardbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onboardbase