Sha256: 31d51f48453d9a1b3f2180640b7a59ecfd351639f072fcedbd9c342a029d7e9d

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

require 'hiera'
require 'vault'

class Hiera
  module Backend
    # rubocop:disable Naming/ClassAndModuleCamelCase
    class Vault_backend
      def initialize
        Hiera.debug('Hiera vault backend starting')

        @client = Vault::Client.new
      end

      def lookup(key, scope, _order_override, resolution_type, _context)
        Hiera.debug("Looking up #{key} in vault backend " \
                    "with #{resolution_type}")

        secret = @client.kv('kv').read(key)
        throw(:no_such_key) unless secret

        value = secret.data[:value]
        throw(:no_such_key) unless value

        Backend.parse_answer(value, scope)
      end
    end
    # rubocop:enable Naming/ClassAndModuleCamelCase
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
confidante-0.28.0.pre.13 lib/hiera/backend/vault_backend.rb