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

feat(gcs): allow setting a token directly #4978

Merged
merged 13 commits into from
Aug 13, 2024
Next Next commit
feat: add token to gcsconfig
jdockerty committed Aug 7, 2024
commit 5278aaf587734f694e346455718942fda39d310f
8 changes: 8 additions & 0 deletions core/src/services/gcs/backend.rs
Original file line number Diff line number Diff line change
@@ -74,6 +74,8 @@ pub struct GcsConfig {
pub disable_vm_metadata: bool,
/// Disable loading configuration from the environment.
pub disable_config_load: bool,
/// A Google Cloud OAuth2 token.
pub token: String,
jdockerty marked this conversation as resolved.
Show resolved Hide resolved
}

impl Debug for GcsConfig {
@@ -214,6 +216,12 @@ impl GcsBuilder {
self
}

/// Provide the OAuth2 token to use.
pub fn token(mut self, token: String) -> Self {
self.config.token = token;
self
}

/// Disable attempting to load credentials from the GCE metadata server.
pub fn disable_vm_metadata(mut self) -> Self {
self.config.disable_vm_metadata = true;