googleapis / googleapis/google-cloud-rust

Make `google-cloud-auth` work in virtualized environments

Open
#5,168 9 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
Rust
Stars
955
Forks
144
Avg merge
1d 5h
Merged PRs (30d)
279

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.