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

Programmatic equivalent to AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED #4024

Open
hniksic opened this issue Feb 19, 2025 · 4 comments
Open

Comments

@hniksic
Copy link

hniksic commented Feb 19, 2025

We need to configure AWS to use AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED. AWS storage is (optionally) used by a library, which is an implementation detail, so we'd like to avoid requiring everyone who run binaries that use the library to change their environment. For that reason we currently use:

std::env::set_var("AWS_REQUEST_CHECKSUM_CALCULATION", "WHEN_REQUIRED");
std::env::set_var("AWS_RESPONSE_CHECKSUM_CALCULATION", "WHEN_REQUIRED");

but that is error-prone, affects the whole process, and will become unsafe in the next Rust edition.

Is there a way to do it programmatically? For example, something like request_checksum_calculation in Python's botocore.config.Config.

@landonxjames
Copy link
Contributor

This is available on the SdkConfig via the request_checksum_calculation and the response_checksum_validation settings.

@hniksic
Copy link
Author

hniksic commented Feb 19, 2025

How do I affect these settings, though? The functions you linked only appear to query them, not modify them.

@landonxjames
Copy link
Contributor

Ah sorry, linked to the wrong ones, you do it with the same methods on the Builder for the SdkConfig: https://docs.rs/aws-types/1.3.5/aws_types/sdk_config/struct.Builder.html#method.request_checksum_calculation

@hniksic
Copy link
Author

hniksic commented Feb 19, 2025

Thanks. I think I missed these because I was looing at aws_config::ConfigLoader, which we are currently using. Is it possible to configure these settings using the ConfigLoader? The docs for aws_types::sdk_config::Builder say:

Important: Using the aws-config crate to configure the SDK is preferred to invoking this builder directly. Using this builder directly won’t pull in any AWS recommended default configuration values.

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

No branches or pull requests

2 participants