问题
This page explains both:
- Obtaining and providing service account credentials manually for developing local, deploying on-premises, or deploying to another public cloud.
- Obtaining credentials on Compute Engine, Kubernetes Engine, App Engine flexible environment, and Cloud Functions
But there is no mention of obtaining credentials on Cloud Run. I'd appreciate it if you give instructions for obtaining credentials and setting firebase-admin initializeApp
and firebase initializeApp
for authentication on Cloud Run.
回答1:
The documentation suggests that you can use the default service account just like other Google Cloud products as described here. The Firebase Admin SDK should use that account when initialized with no parameters.
There are also steps described if you want to use a non-default service account, which you can simply configure in the console or provide with gcloud.
If you must provide a file that's readable at runtime, you will have to deploy an image with that file added to the image. There is no short set of steps to add that file - you will have to make your docker build include it in a readable location, and your code will know where to look for it in order to load it.
来源:https://stackoverflow.com/questions/60033551/how-can-i-obtain-gcp-service-account-credentials-on-google-cloud-run