diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-05-31 08:22:55 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-31 08:22:55 +0300 |
commit | 39e21fb2661693fed914012a39fb3a53b2b687c2 (patch) | |
tree | 70a5fdd93cea81aed9c1638bc32513a1fdf84bb7 /db/migrate | |
parent | c8c08d326942f30ad87d0702cc8b9c5896d296ad (diff) |
Generate lets_encrypt_private_key on the fly
Remove migration generating lets encrypt key
Don't generate private_key if database is readonly
For reference:
This reverts commit 988a7f70489b99383b95e9f271a2caf6bb5b3a44.
This reverts commit 21acbe531592d55caf0e5b8716a3b551dafd6233.
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20190524062810_generate_lets_encrypt_private_key.rb | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb b/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb index 21d7049b998..ae93a76575a 100644 --- a/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb +++ b/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb @@ -9,23 +9,8 @@ class GenerateLetsEncryptPrivateKey < ActiveRecord::Migration[5.1] # Set this constant to true if this migration requires downtime. DOWNTIME = false - class ApplicationSetting < ActiveRecord::Base - self.table_name = 'application_settings' - - attr_encrypted :lets_encrypt_private_key, - mode: :per_attribute_iv, - key: Settings.attr_encrypted_db_key_base_truncated, - algorithm: 'aes-256-gcm', - encode: true - end - + # we now generate this key on the fly, but since this migration was merged to master, we don't remove it def up - ApplicationSetting.reset_column_information - - private_key = OpenSSL::PKey::RSA.new(4096).to_pem - ApplicationSetting.find_each do |setting| - setting.update!(lets_encrypt_private_key: private_key) - end end def down |