Class: Rails::Generators::EncryptedFileGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/rails/commands/encrypted_command.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template) ⇒ Object



128
129
130
131
132
133
# File 'lib/rails/commands/encrypted_command.rb', line 128

def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template)
  unless File.exist?(file_path)
    setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY", raise_if_missing_key: true }
    ActiveSupport::EncryptedFile.new(setup).write(template)
  end
end