diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-03-02 19:38:42 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-03-02 19:38:42 +0100 |
commit | d22f8796919b2e8eeadce1d74ad4cf33f695e57e (patch) | |
tree | fe88c5d137020cfdf40fe8f8f58c6c279b0d81ec | |
parent | e3b4554f231beb789b981dfb5e32789f5ad4d17b (diff) | |
download | rails-d22f8796919b2e8eeadce1d74ad4cf33f695e57e.tar.gz rails-d22f8796919b2e8eeadce1d74ad4cf33f695e57e.tar.bz2 rails-d22f8796919b2e8eeadce1d74ad4cf33f695e57e.zip |
Inline CIPHER constant.
-rw-r--r-- | railties/lib/rails/secrets.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/railties/lib/rails/secrets.rb b/railties/lib/rails/secrets.rb index 77d9249c56..2a95712cd9 100644 --- a/railties/lib/rails/secrets.rb +++ b/railties/lib/rails/secrets.rb @@ -13,8 +13,7 @@ module Rails end end - CIPHER = "aes-128-gcm" - + @cipher = "aes-128-gcm" @read_encrypted_secrets = false @root = File # Wonky, but ensures `join` uses the current directory. @@ -33,9 +32,7 @@ module Rails end def generate_key - SecureRandom.hex( - OpenSSL::Cipher.new(CIPHER).key_len - ) + SecureRandom.hex(OpenSSL::Cipher.new(@cipher).key_len) end def key @@ -102,7 +99,7 @@ module Rails end def encryptor - @encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: CIPHER) + @encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: @cipher) end end end |