onboardbase 1.0.9 → 1.1.0

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: b1743af3711480fa93000360faf5c480e9c101f1bc740cc7c6bac47868e10644
4
+ data.tar.gz: 980fc8ef15b92af76d7d8e880bce2b6421b8d6a58f814a3f8065da4aef0fcc51
5
5
  SHA512:
6
- metadata.gz: dde86f766f8219e44137c8345d60fc58bf9d43cbf44bd5aa16689e1e8e16eb0a2a275e48546865609b296735e461accc8c7108bc9b57fe9dac12f9f1873c7174
7
- data.tar.gz: 6e3ff821a6a2723c8626d74aeab4e5eb247a31eede468da4c23381ffba0ee33910572f15dc54a76b5a7886f6c29031141df9b707b831e3ee325995dcbeb6bbeb
6
+ metadata.gz: f0086f2e904bda6b4fa091d11fca7792cd21da8957ac75830764d7b89707e6309fc11633ea57367aceb8740b6bad46a6655973eb2e997590ed62d1be26ce7edc
7
+ data.tar.gz: 78db52e399e86484cbd7e04120b7b6919f2dff885295e948a48e9796bd2d8226a23ba964b4dcc5fb3e8a27d74a5a93639b5e1f307b6437142e6846a66fe7ec10
@@ -1,3 +1,3 @@
1
1
  module Onboardbase
2
- VERSION = '1.0.9'
2
+ VERSION = '1.1.0'
3
3
  end
data/lib/onboardbase.rb CHANGED
@@ -246,6 +246,30 @@ 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
+ require "active_support/encrypted_configuration"
259
+ credentials = ActiveSupport::EncryptedConfiguration.new(
260
+ config_path: self.content_path,
261
+ key_path: self.key_path,
262
+ env_key: "RAILS_MASTER_KEY",
263
+ raise_if_missing_key: true
264
+ )
265
+
266
+ secrets = YAML.load(credentials.read)
267
+ secrets.keys.sort.each do |key|
268
+ ENV["#{key}"] = "#{secrets[key]}"
269
+ end
270
+ credentials.write(ENV.to_hash.to_yaml)
271
+ end
272
+
249
273
  def loadSecrets
250
274
  self.loadConfig
251
275
  response = self.parseResponse?(self.makeRequest)
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onboardbase