Commit e6cc5f2a authored by DJ Mountney's avatar DJ Mountney

Apply 6 suggestion(s) to 2 file(s)

parent add38cc7
......@@ -41,7 +41,7 @@ module Gitlab
def read
if active?
decrypt content_path.binread
decrypt(content_path.binread)
else
""
end
......@@ -55,7 +55,7 @@ module Gitlab
File.open(temp_file.path, 'wb') do |file|
file.write(encrypt(contents))
end
FileUtils.mv temp_file.path, content_path
FileUtils.mv(temp_file.path, content_path)
ensure
temp_file&.unlink
end
......@@ -71,7 +71,7 @@ module Gitlab
end
def change(&block)
writing read, &block
writing(read, &block)
end
private
......@@ -84,12 +84,12 @@ module Gitlab
def encrypt(contents)
handle_missing_key!
encryptor.encrypt_and_sign contents
encryptor.encrypt_and_sign(contents)
end
def decrypt(contents)
handle_missing_key!
encryptor.decrypt_and_verify contents
encryptor.decrypt_and_verify(contents)
end
def encryptor
......
......@@ -79,7 +79,7 @@ RSpec.describe Gitlab::EncryptedConfiguration do
expect(config.foo[:bar]).to be true
end
it 'throws a custom error when deferencing an invalid key map config' do
it 'throws a custom error when referencing an invalid key map config' do
config = described_class.new(content_path: credentials_config_path, base_key: credentials_key)
config.write("stringcontent")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment