Sha256: 8a8c5ad2d462ec0088e4a5f3c55266cf8b186405de74a699eeeacd9008d15a59
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 Bytes
Contents
require "itamae" module Itamae module Plugin module Resource require "tempfile" require "reversible_cryptography" class EncryptedRemoteFile < ::Itamae::Resource::RemoteFile define_attribute :password, type: String def pre_action encrypted_data = File.read(source_file).strip decrypted_data = ReversibleCryptography::Message.decrypt(encrypted_data, attributes.password) @decrypted_tempfile = Tempfile.open(File.basename(source_file)) do |f| f.write(decrypted_data) f end super end def content_file @decrypted_tempfile.path end def action_create(options) super @decrypted_tempfile.close! if @decrypted_tempfile end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems