Sha256: b8c02bcb2614e3b3bbb5fa139b82612f12b07164c19b665f3e6779da4d44ddb2

Contents?: true

Size: 428 Bytes

Versions: 4

Compression:

Stored size: 428 Bytes

Contents

# frozen_string_literal: true

class Cryptoform::StorageBackends::File < Cryptoform::StorageBackends::Backend
  def read
    ::File.read(filename)
  rescue Errno::ENOENT
    raise Cryptoform::StateMissingError, "state '#{@state_name}' is configured but missing"
  end

  def write(data)
    ::File.write(filename, data)
  end

  private

  def filename
    @filename ||= @params[:name] || "#{@state_name}.tfstate.enc"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cryptoform-0.5.1 lib/cryptoform/storage_backends/file.rb
cryptoform-0.5.0 lib/cryptoform/storage_backends/file.rb
cryptoform-0.4.0 lib/cryptoform/storage_backends/file.rb
cryptoform-0.2.0 lib/cryptoform/storage_backends/file.rb