Sha256: 532c15e02310d06b8f4ba288df3f2447854b7ce7efc3dab3329f94ca9cc4578d

Contents?: true

Size: 794 Bytes

Versions: 39

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require "rails/generators/base"
require "active_support/core_ext/string/strip"
require "active_support/encrypted_file"

module Rails
  module Generators
    class EncryptedFileGenerator < Base # :nodoc:
      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

      private
        def encrypted_file_template
          <<-YAML.strip_heredoc
          # aws:
          #   access_key_id: 123
          #   secret_access_key: 345

          YAML
        end
    end
  end
end

Version data entries

39 entries across 39 versions & 3 rubygems

Version Path
railties-5.2.8.1 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.8 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.7.1 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.7 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.6.3 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.6.2 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.6.1 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.6 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.6 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.5 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.5 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.4 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.3 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.2 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.1 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
railties-5.2.4.rc1 lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb