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

Support for GOOGLE_CLOUD_KEYFILE_JSON as in ruby client library #395

Closed
phoet opened this issue Mar 18, 2021 · 2 comments
Closed

Support for GOOGLE_CLOUD_KEYFILE_JSON as in ruby client library #395

phoet opened this issue Mar 18, 2021 · 2 comments
Assignees
Labels
api: storage Issues related to the googleapis/python-storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@phoet
Copy link

phoet commented Mar 18, 2021

The ruby clients support passing the client configuration as an environment variable (GOOGLE_CLOUD_KEYFILE_JSON) cointaining a json blob instead of a path to a json config file.

https://github.com/googleapis/google-cloud-ruby/blob/1a7cfef70298276a9203658748e9d70edfcfb2d5/google-cloud-datastore/samples/README.md#authenticating

It would be super helpful (and less confusing) if there was a similar option in the python library.

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Mar 18, 2021
@JesseLovelace JesseLovelace added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 18, 2021
@tseaver
Copy link
Contributor

tseaver commented May 4, 2021

Related: googleapis/python-cloud-core#54 adds a from_service_account_info factory to the client base class, which would allow for the following:

import os
from google.cloud.storage import Client

keyfile_json = os.getenv("GOOGLE_CLOUD_KEYFILE_JSON")
if keyfile_json is not None:
    client = Client.from_service_account_info(keyfile_json)
else:  # fall back to normal env vars
    client = Client()

@tseaver
Copy link
Contributor

tseaver commented Jul 13, 2021

Closing, given that the api-core PR has landed, and the spelling above accomplishes the requested usage.

@tseaver tseaver closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants