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

A couple of small fixes in the recently-added Azure blob storage support #910

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

tamwuff
Copy link
Contributor

@tamwuff tamwuff commented Nov 11, 2024

This is a followup to #907

I was working on the webadmin changes, and I realized that the way that webadmin works, there's only one field in the form that is named "access-key". If we try to use that one field from both the Azure and the S3 back ends, yes, the field will get hidden and un-hidden based on what type of store we're adding. But it's still the same field.

This is not wonderful, because in the case of S3, "access-key" is not particularly secret. It's the "login name", if you will, not the "password". But Azure uses the same terminology to refer to what is, in effect, the "password". And we really want to display those two types of things differently from each other. The non-secret "access key" in S3 should be displayed as a regular text input field; the secret "access key" in Azure should be displayed as a password-type field.

We can't change the name of the field used by S3, because that would be a breaking change. But we can change the name of the field used by Azure. This PR makes the Azure back end use the config field name "azure-access-key" instead of "access-key".

Notably, renaming the "access-key" configuration field to "azure-access-key", not because
stalwart-mailserver needs the field name to change, but because having a field whose name
is the same between Azure and S3 but whose function is different, causes headaches for
webadmin.
@@ -126,6 +126,7 @@ impl AzureStore {
}
Err(e) => {
err = Some(e);
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was something I noticed after I submitted my previous PR; if we get an error, we don't have to keep consuming from the stream, we can just break out right away and return the error to the caller.

The code would be correct either way, but it seems more efficient to do it this way and break out as soon as we know for sure we have an error.

@mdecimus mdecimus merged commit 3b950ce into stalwartlabs:main Nov 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants