-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
auth: 'GOOGLE_CLOUD_QUOTA_PROJECT' env variable should override quota project setting from credential file #10804
Comments
Because we were explicitly setting the value of quota project in the credentials package the logic that should have checked the environment variable was never hit if the value was set in the creds file. So for now we will not set it in this package. The getter on the creds will then default to the correct logic in internal.go. Also mark an integration test as such so it does not run when the short flag is passed. Fixes: googleapis#10804
Thank you for the report. I believe I have a PR to fix this linked above, please lmk if that works for your usecase. The solution you purposed is something we do want to do in the future, but there is more to it that requires work in the transport packages to feed some values in quota project fields as well. I filed #10808 to track this explicit feature. |
…10807) Because we were explicitly setting the value of quota project in the credentials package the logic that should have checked the environment variable was never hit if the value was set in the creds file. So for now we will not set it in this package. The getter on the creds will then default to the correct logic in internal.go. Also mark an integration test as such so it does not run when the short flag is passed. Fixes: #10804
🤖 I have created a release *beep* *boop* --- ## [0.9.3](https://togithub.com/googleapis/google-cloud-go/compare/auth/v0.9.2...auth/v0.9.3) (2024-09-03) ### Bug Fixes * **auth:** Choose quota project envvar over file when both present ([#10807](https://togithub.com/googleapis/google-cloud-go/issues/10807)) ([2d8dd77](https://togithub.com/googleapis/google-cloud-go/commit/2d8dd7700eff92d4b95027be55e26e1e7aa79181)), refs [#10804](https://togithub.com/googleapis/google-cloud-go/issues/10804) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Thank you @codyoss, what you proposed unlocks path to check env variable before conclude on quota project variable. My use case will work with this. |
Client
Client which works with new auth library
Environment
% go version
go version go1.22.6 darwin/arm64
Code and Dependencies
go.mod
Expected behavior
When I set "GOOGLE_CLOUD_QUOTA_PROJECT" environment variable I would expect that quota project defined by that variable will be used instead of what is defined in credential file. This is a behavior of previous (current) auth code: https://github.com/googleapis/google-api-go-client/blob/main/internal/creds.go#L242-L261
Actual behavior
Additional context
#10797 fixed similar issue for overriding through client option, but env variable will not be take into consideration because file credentials found in default location will populate credential struct with QuotaProjectID: https://github.com/googleapis/google-cloud-go/blob/main/auth/grpctransport/grpctransport.go#L262 and https://github.com/googleapis/google-cloud-go/blob/main/auth/auth.go#L176-L180 which will cause not looking into env variables https://github.com/googleapis/google-cloud-go/blob/main/auth/internal/internal.go#L98-L100.
The text was updated successfully, but these errors were encountered: