-
Notifications
You must be signed in to change notification settings - Fork 118
Make google-cloud-auth work in virtualized environments #5168
Description
Objective
Run google-cloud-rust in environments where std::env::var, std::fs::File, or reqwest::Client may not work. The first step is running google-cloud-auth.
Overview
Add dyn-compatible traits to represent std::env::var, std::fs::File, and reqwest::Client. Use these traits in the implementation of google-cloud-auth. Define some configuration flags to google_cloud_auth::credentials::Builder to replace the default traits with custom ones.
Details
The traits for std::env::var and std::fs::File are more or less straightforward.
Abstracting the HTTP client requires more machinery. We need to use a dyn-compatible trait for the asynchronous methods, so the usual abstractions around async_trait apply.
Alternatives Considered
Use traits that are not dyn-compatible.
This would require breaking changes and modify every API. Not really a good option, just documenting it here.