lib/symmetric_encryption/railtie.rb in symmetric-encryption-3.1.0 vs lib/symmetric_encryption/railtie.rb in symmetric-encryption-3.2

- old
+ new

@@ -31,15 +31,18 @@ # iv: 1234567890ABCDEF # # Loaded before Active Record initializes since database.yml can have encrypted # passwords in it config.before_configuration do - config_file = Rails.root.join("config", "symmetric-encryption.yml") - if config_file.file? - ::SymmetricEncryption.load!(config_file, Rails.env) - else - puts "\nSymmetric Encryption config not found." - puts "To generate one for the first time: rails generate symmetric_encryption:config\n\n" + # Check if already configured + unless ::SymmetricEncryption.cipher? + config_file = Rails.root.join("config", "symmetric-encryption.yml") + if config_file.file? + ::SymmetricEncryption.load!(config_file, Rails.env) + else + puts "\nSymmetric Encryption config not found." + puts "To generate one for the first time: rails generate symmetric_encryption:config\n\n" + end end end end end