class EasyConf::Lookup::EVault

Public Class Methods

read(key) click to toggle source
# File lib/easy_conf/lookup/e_vault.rb, line 35
def read(key)
  value = read_vault(key)
  value && commit(value)
end

Private Class Methods

key_path(key) click to toggle source
# File lib/easy_conf/lookup/e_vault.rb, line 51
def key_path(key)
  "#{lookup_config.key_prefix}/#{key}"
end
read_vault(key) click to toggle source
# File lib/easy_conf/lookup/e_vault.rb, line 41
def read_vault(key)
  vault_path = key_path(key)

  secret = Vault.with_retries(Vault::HTTPError) do
    Vault.logical.read(vault_path)
  end

  secret && secret.data && secret.data[:value]
end