Sha256: 25cda4abab2ee714e3f8d98285a5ac62c37cfe52f8b13a76696f84c4d1ef022a
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
# encoding: utf-8 module SymmetricEncryption #:nodoc: class Railtie < Rails::Railtie #:nodoc: # Exposes Symmetric Encryption's configuration to the Rails application configuration. # # @example Set up configuration in the Rails app. # module MyApplication # class Application < Rails::Application # config.symmetric_encryption.cipher = SymmetricEncryption::Cipher.new( # key: '1234567890ABCDEF', # iv: '1234567890ABCDEF', # cipher_name: 'aes-128-cbc' # ) # end # end config.symmetric_encryption = ::SymmetricEncryption rake_tasks do load 'symmetric_encryption/railties/symmetric_encryption.rake' end # Initialize Symmetry. This will look for a symmetry.yml in the config # directory and configure Symmetry appropriately. # # @example symmetric-encryption.yml # # development: # cipher_name: aes-128-cbc # key: 1234567890ABCDEF # iv: 1234567890ABCDEF # # Loaded before Active Record initializes since database.yml can have encrypted # passwords in it config.before_configuration do # Check if already configured unless ::SymmetricEncryption.cipher? config_file = Rails.root.join('config', 'symmetric-encryption.yml') if config_file.file? begin ::SymmetricEncryption::Config.load!(config_file, Rails.env) rescue ArgumentError => exc puts "\nSymmetric Encryption not able to read keys." puts "#{exc.class.name} #{exc.message}" puts "To generate key files: bin/rails generate symmetric_encryption:new_keys #{Rails.env}\n\n" end else puts "\nSymmetric Encryption config not found." puts "To generate one for the first time: bin/rails generate symmetric_encryption:config\n\n" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
symmetric-encryption-3.9.1 | lib/symmetric_encryption/railtie.rb |
symmetric-encryption-3.9.0 | lib/symmetric_encryption/railtie.rb |