-
Notifications
You must be signed in to change notification settings - Fork 850
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
Simplify ObjectStore configuration pattern #4189
Conversation
@@ -742,18 +727,28 @@ impl AmazonS3Builder { | |||
AmazonS3ConfigKey::UnsignedPayload => { | |||
self.unsigned_payload = str_is_truthy(&value.into()) | |||
} | |||
AmazonS3ConfigKey::Checksum => { | |||
let algorithm = Checksum::try_from(&value.into()) | |||
.map_err(|_| Error::InvalidChecksumAlgorithm)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was problematic as this error would get unwrapped in from_env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed properly in #4192
@roeap perhaps you might be able to give this a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great - looking back, making the config fallible was a big regret :D.
Really looking forward to the deferred parsing as well, which would allow us to pass in impl AsRef<str>
's again? Although that is just a slight convenience upgrade.
Thank you for the prompt review 💪
#4192 should be ready for review now, it currently only defers the parsing of values, and so the key arguments are still typed. I personally think this is more idiomatic, and allows users to choose how to handle unexpected keys, but appreciate opinions may differ. |
Which issue does this PR close?
Relates to #4047
Rationale for this change
Originally added in #3436 by @roeap, the API can be made simpler and easier to use
What changes are included in this PR?
Are there any user-facing changes?
This makes the config enumerations non exhaustive, so that options can be added without it being a breaking change