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

(feature request): read project id from metadata #190

Closed
ilteoood opened this issue Sep 10, 2024 · 1 comment · Fixed by #191
Closed

(feature request): read project id from metadata #190

ilteoood opened this issue Sep 10, 2024 · 1 comment · Fixed by #191
Labels
enhancement New feature or request

Comments

@ilteoood
Copy link
Contributor

At the moment, the project id is a required parameter.
In environments like Google App Engine standard, the project id can be extracted from the credentials file or from the GOOGLE_CLOUD_PROJECT.

Can you consider to make it optional?
I would be more than happy to contribute to it.

@abdolence abdolence added the enhancement New feature or request label Sep 10, 2024
@abdolence
Copy link
Owner

Hey,

Google Cloud SDK already have a method to detect project ID from environment variable, service account key file, etc.
https://github.com/abdolence/gcloud-sdk-rs/blob/374b86ffda52c2d133c04259346b3a10063d3724/gcloud-sdk/src/api_client.rs#L151
So, this is simple to implement if needed and I'm gladly accept a PR if you want to give a try :)
Something like for_default_project_id() that just wraps call GoogleEnvironment::detect_google_project_id() and calls new with it. It will be async though, since detection in Google servers and environments is a network call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants