Skip to content

Make google-cloud-auth work in virtualized environments #5168

@coryan

Description

@coryan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions