google-cloud-functions - 将敏感信息传递给云功能

标签 google-cloud-functions

是否存在用于将敏感信息(例如API密钥)传递到Google Cloud Functions的“官方”解决方案?特别是最好避免将此信息作为参数传递给函数,因为对于每次调用它都是相同的。 AWS Lambda为此使用了加密环境变量的built-in solution。 Google Cloud Functions是否有类似的方法?

我可以想象为此使用云存储桶或云数据存储,但这感觉非常手动。

最佳答案

如果您将Cloud Functions与Firebase一起使用,则需要查找environment configuration

这样,您可以从Firebase CLI部署配置数据:

firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"


然后使用以下命令在函数中阅读:

functions.config().someservice.id

关于google-cloud-functions - 将敏感信息传递给云功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42959284/

相关文章:

Firebase云函数部署错误

node.js - nodejs .node-xmlhttprequest-sync-1 文件已创建

javascript - 将中间件添加到一行/函数中的所有 firebase 函数

javascript - Google Cloud Functions - 重试

google-app-engine - Google Cloud Platform 上的双向 TLS 身份验证

python - 如何在 git 上构建多个函数以在 Google Cloud Functions 上自动部署?

python - 使用 Google Cloud Function 的 SSH 隧道

firebase - 找不到模块 '@google-cloud/logging'

javascript - 如何获取包含字符串的数组的文档? Cloud Firestore 和 Cloud Functions

typescript - Firebase 云函数对象可能是 'undefined'