Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make EncryptedFile more memoization-friendly #45657

Merged

Conversation

jonathanhefner
Copy link
Member

Prior to this commit, EncryptedFile would internally memoize when a key file was non-existent. This meant that a key file generated after checking encrypted_file.key.nil? would not be recognized, unless a new EncryptedFile instance was used. (Though setting the key in a designated environment variable instead would entirely bypass this memoization.)

This commit changes EncryptedFile to only memoize when the key file has been read. Consequently, this commit memoizes the EncryptedFile (or, specifically, EncryptedConfiguration) instance used by CredentialsCommand.

This commit also adds more test coverage around key file generation for CredentialsCommand.

Prior to this commit, `EncryptedFile` would internally memoize when a
key file was non-existent.  This meant that a key file generated after
checking `encrypted_file.key.nil?` would not be recognized, unless a new
`EncryptedFile` instance was used.  (Though setting the key in a
designated environment variable instead would entirely bypass this
memoization.)

This commit changes `EncryptedFile` to only memoize when the key file
has been read.  Consequently, this commit memoizes the `EncryptedFile`
(or, specifically, `EncryptedConfiguration`) instance used by
`CredentialsCommand`.

This commit also adds more test coverage around key file generation for
`CredentialsCommand`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant