Sha256: 5124010331b02b8d9c7db906f762ffcc58989d26070d882cb5d236498650e71d
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Roro module Crypto # Key writer Writes keys arguments for environments, directory and extension where # environments are the names of the keys to be generated, directory # is the destination folders the keys will be wrtten in and extension is # the extension of the key file. class KeyWriter include Roro::FileReflection def initialize @writer = FileWriter.new @cipher = Cipher.new @mise = Roro::CLI.mise end def write_keyfile(environment, extension = '.key') destination = "#{@mise}/keys/#{environment}#{extension}" @writer.write_to_file(destination, @cipher.generate_key) end def write_keyfiles(environments = [], directory = nil, extension = nil) directory ||= @mise extension ||= '.key' if environments.empty? environments = gather_environments(directory, '.env').uniq end environments.uniq.each { |environment| write_keyfile(environment, extension) } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems