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

Documentation failing to build on docs.rs #54

Open
officialpiyush opened this issue Jan 18, 2023 · 9 comments
Open

Documentation failing to build on docs.rs #54

officialpiyush opened this issue Jan 18, 2023 · 9 comments

Comments

@officialpiyush
Copy link

I am trying to use firestore crate, which is dependent on this crate for authentication. I want to use my service account configuration with it, so I tried to check the documentation of this crate for reference, but it shows that the documentation build wasn't successful.

image

@abdolence
Copy link
Owner

abdolence commented Jan 18, 2023

Hey, I think docs.rs is failing because of this crate has a lot of crate features defined (docs.rs pipeline throws out of memory errors). I'll try to investigate if it is possible to do something about it.

There is a section about Google authentication that may answer your question:
https://github.com/abdolence/gcloud-sdk-rs#google-authentication

Also you can ask here what you want to achieve.

@officialpiyush
Copy link
Author

officialpiyush commented Jan 18, 2023

Hey @abdolence, appreciate the quick response, I saw the Google authentication part in the README, though I was looking if we could manually specify the path of the service account, instead of using environment variables. It is worth mentioning that I am using firestore crate. I have the service account file (from Firebase), just wondering if we have an option to manually set the file location.

@abdolence
Copy link
Owner

The way this is currently implemented is somehow similar how Google itself implements this in their client libraries.
(https://cloud.google.com/docs/authentication/client-libraries).

The important part is that on production you usually rely on the GKE/GCE/Cloud Run etc environments that configure service accounts for you themselves, and you should use it from the "environment". Creating and managing JSON files manually is considered less secure approach nowadays.

Theoretically speaking It is possible to implement even more options to specify it explicitly, but I don't remember that I have had the implementation to use it directly that way right now. I need a bit more input to understand what is the purposes for this - development, production?

Of course there is a workaround, so you can just specify it as environment variable in the code (e.g. https://doc.rust-lang.org/std/env/fn.set_var.html).

@officialpiyush
Copy link
Author

Thanks for the info!

I am trying to upload some data from the system, and then save it to Firestore, to be later accessed from the web. The binary would be built and distributed. I could just add an instruction to set the environment variable, but it may have chances that it may collide with their own development environment. I could use the set_var, sure, was just looking if there was any native option provided by the library.

@abdolence
Copy link
Owner

Thanks for the details. Yes, in your case now I understand more and it is totally makes sense to configure it that way. Right now this library doesn't provide it instead of env bars, so you can leverage it. I'll improve this area in next releases for the cases like yours.

@officialpiyush
Copy link
Author

Thanks! Really appreciate the work you are doing! <3

Shall I keep the issue open till the issue with the documentation is solved, or do you want me to close it?

@abdolence
Copy link
Owner

Appreciate the kind words.
Yes, keep it open. I'm not scared of opened issues especially if they are correct :)

@abdolence
Copy link
Owner

abdolence commented Jan 18, 2023

@officialpiyush
Ok, I browsed the source code and now I remember that in fact we have the way to do everything programmatically:

FirestoreDb::with_options_token_source(
        FirestoreDbOptions::new(config_env_var("PROJECT_ID")?.to_string()),
        gcloud_sdk::GCP_DEFAULT_SCOPES.clone(),
        gcloud_sdk::TokenSourceType::File("/tmp/key.json".into())
    )
    .await?;

It is a bit cumbersome for your purposes, but exposes all possible options.
Let me know if this doesn't work!

@officialpiyush
Copy link
Author

I'll try it out and let you know!

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

No branches or pull requests

2 participants