Google Firestore客户端没有JSON凭据文件
我需要将代码在Docker映像中运送到无服务器平台,在该平台中我无法放置CREDS文件。
通常,我只会将firestore_creds.json
复制到构建时间并在本地运行的图像,但这在运输代码时并不正确,并且非常不安全。
环境变量
export GOOGLE_APPLICATION_CREDENTIALS="firestore_creds.json"
python就是这样,client()
仅从init上的set env var读取。
from google.cloud import firestore
client = firestore.Client()
我该如何创建此client
而没有出现的JSON CREDS文件?
注:我真的很想避免将信用授予作为JSON字符串环境VAR,然后阅读,写入文件,然后继续。这似乎很混乱,真的很丑陋。
I need to ship my code in a Docker image to a serverless platform in which I cannot place a creds file.
Typically, I would just copy the firestore_creds.json
into to the image at build time and run locally, but this isn't the right thing to do when shipping code and is horribly insecure.
Environment variable
export GOOGLE_APPLICATION_CREDENTIALS="firestore_creds.json"
Python is as such, and the Client()
just reads from the set env vars on init.
from google.cloud import firestore
client = firestore.Client()
How do I go about creating this Client
without a json creds file present?
Note: I'd really like to avoid having to place the creds as a json string environment var, then read it, write to a file, and continue. That seems messy and really ugly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如线程
您也可以检查此答案
为了通过客户端应用程序获得与安全访问Firestore有关的更多信息,您可以检查安全规则 and cloud firstore firstore firstore firstore rest res reast api
提供了一个很好的答案在这里与安全访问有关
As mentioned in the thread
You can also check this Answer
In order to get more information related to the safe access to Firestore through client App, you can check the security rules and Cloud Firstore Rest API
A Good answer Provided here related to the safe access as :