Skip to content

Commit e4b72f8

Browse files
committed
Move encryption config to application.rb so it's set earlier
Upgrading flipper caused the tests to break because when it triggered the application record encyption settings to be initialized before they were configured. Rails suggests putting this config into the application.rb[1], which ensures it is loaded earlier and avoids this problem. I scan the flipper changes and it's not obvious what caused this, but it's likely to do with changes in interaction with active record. Alternatively we could set flipper to 'require: false',. [1] - https://guides.rubyonrails.org/active_record_encryption.html
1 parent d6d98e5 commit e4b72f8

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

config/application.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,9 @@ class Application < Rails::Application
6060

6161
config.middleware.insert_before 0, CorpMiddleware
6262
config.generators.system_tests = nil
63+
64+
config.active_record.encryption.primary_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY')
65+
config.active_record.encryption.deterministic_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY')
66+
config.active_record.encryption.key_derivation_salt = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT')
6367
end
6468
end

config/initializers/encryption.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)