Skip to content

Conversation

@brocaar
Copy link
Contributor

@brocaar brocaar commented Jan 23, 2022

See #45.

This adds a from_credentials_json function so that the credentials can be parsed from a JSON string.

I changed get_authentication_manager such that instead of an optional path, one can pass an Option<CustomServiceAccount>. The from_credentials_file function now handles the reading of the given path and the from_credentials_json handles the reading of the given JSON.

I updated the init() function such that it first checks GOOGLE_APPLICATION_CREDENTIALS and if it exists, it will try to read from that path (if not it errors). If no such env variable exists, it calls get_authentication_manager with None.

This function can be used to initialize from a JSON string rather than a
path to the credentials file.

Closes djc#45.
@djc
Copy link
Owner

djc commented Jan 23, 2022

Thanks for working on this! Still need to clean up the clippy lint, too.

@djc djc merged commit f6de1d2 into djc:master Jan 24, 2022
@brocaar brocaar deleted the credentials_from_json branch January 24, 2022 10:32
@brocaar
Copy link
Contributor Author

brocaar commented Jan 24, 2022

Thanks for reviewing and merging @djc !

@djc
Copy link
Owner

djc commented Jan 24, 2022

@brocaar I made a bunch of follow-up changes in #49 which change the API for this, let me know if you have any feedback.

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.

2 participants