lib/symmetric_encryption/railtie.rb in symmetric-encryption-4.3.1 vs lib/symmetric_encryption/railtie.rb in symmetric-encryption-4.3.2

- old
+ new

@@ -27,22 +27,22 @@ # 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? - parent_method = Module.method_defined?(:module_parent) ? 'module_parent' : 'parent' - app_name = Rails::Application.subclasses.first.send(parent_method).to_s.underscore - env_var = ENV['SYMMETRIC_ENCRYPTION_CONFIG'] - config_file = + parent_method = Module.method_defined?(:module_parent) ? "module_parent" : "parent" + app_name = Rails::Application.subclasses.first.send(parent_method).to_s.underscore + env_var = ENV["SYMMETRIC_ENCRYPTION_CONFIG"] + config_file = if env_var Pathname.new(File.expand_path(env_var)) else - Rails.root.join('config', 'symmetric-encryption.yml') + Rails.root.join("config", "symmetric-encryption.yml") end if config_file.file? begin - ::SymmetricEncryption::Config.load!(file_name: config_file, env: ENV['SYMMETRIC_ENCRYPTION_ENV'] || Rails.env) + ::SymmetricEncryption::Config.load!(file_name: config_file, env: ENV["SYMMETRIC_ENCRYPTION_ENV"] || Rails.env) rescue ArgumentError => e puts "\nSymmetric Encryption not able to read keys." puts "#{e.class.name} #{e.message}" puts "To generate a new config file and key files: symmetric-encryption --generate --app-name #{app_name}\n\n" raise(e)