Class: Qonfig::Loaders::Vault Private
- Defined in:
- lib/qonfig/plugins/vault/loaders/vault.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- VAULT_EXPR_EVAL_SCOPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
BasicObject.new.__binding__.tap do |binding| Object.new.method(:freeze).unbind.bind_call(binding.receiver) end
Class Method Summary collapse
- .empty_data ⇒ Hash private
- .load_file(path, fail_on_unexist: true) ⇒ Object private
Methods inherited from Basic
Class Method Details
.empty_data ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/qonfig/plugins/vault/loaders/vault.rb', line 41 def empty_data {} end |
.load_file(path, fail_on_unexist: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/qonfig/plugins/vault/loaders/vault.rb', line 24 def load_file(path, fail_on_unexist: true) data = ::Vault.with_retries(Vault::HTTPError) do ::Vault.logical.read(path.to_s)&.data&.dig(:data) end raise Qonfig::FileNotFoundError, "Path #{path} not exist" if data.nil? && fail_on_unexist result = data || empty_data deep_transform_values(result) rescue Vault::VaultError => error raise(Qonfig::VaultLoaderError.new(error.).tap do |exception| exception.set_backtrace(error.backtrace) end) end |