Skip to content

Respect GOOGLE_CLOUD_QUOTA_PROJECT env var when it is set - #6836

Merged
joehan merged 3 commits into
masterfrom
jh-gcqp
Mar 5, 2024
Merged

Respect GOOGLE_CLOUD_QUOTA_PROJECT env var when it is set#6836
joehan merged 3 commits into
masterfrom
jh-gcqp

Conversation

@joehan

@joehan joehan commented Mar 5, 2024

Copy link
Copy Markdown
Member

Description

When GOOGLE_CLOUD_QUOTA_PROJECT is set, we should set x-goog-user-project on outgoing API requests.

This is a common standard accross many google libraries (https://cloud.google.com/docs/quotas/set-quota-project), and we've had a few different cases where this would be useful. It also fixes #6801.

However, I don't have the most thorough understand of how the various x-goog headers work, and whether this is the correct/narrowest one to set here. I'd love a review from someone who is well versed in this.

@joehan
joehan requested review from bkendall and mbleigh March 5, 2024 19:49

@mbleigh mbleigh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to look for x-goog-user-project in the codebase and think about the behavior we want - for instance I manually set it to the current project for auth recently but maybe the env var should override that?

@joehan

joehan commented Mar 5, 2024

Copy link
Copy Markdown
Member Author

You might want to look for x-goog-user-project in the codebase and think about the behavior we want - for instance I manually set it to the current project for auth recently but maybe the env var should override that?

I think you were actually setting x-goog-quota-user (https://cloud.google.com/apis/docs/system-parameters#definitions), which is closely related but only affects quota (x-goog-user-project affects quota and billing). I think x-goog-user-project is the right one to use here for consistency with other tools.

Either way, that is the current behavior here - we always overwrite any heades provided at the call site with this value.

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

Successfully merging this pull request may close these issues.

Add support for GOOGLE_CLOUD_QUOTA_PROJECT across Firebase API client

2 participants