如何从Cloud Run访问Firebase功能环境配置

时间:2019-06-09 19:35:54

标签: firebase google-cloud-functions google-cloud-run

我正在将Firebase功能迁移到Cloud Run。到目前为止,一切都按预期工作,包括Firebase Hosting链接(太好了!)。我只是不确定如何读取为该项目配置的环境变量(通过https://firebase.google.com/docs/functions/config-env)。

1 个答案:

答案 0 :(得分:2)

您将必须找到其他方法来配置Cloud Run。使用Firebase CLI部署时,您将无法访问为Cloud Functions设置的环境变量。只有在使用“ firebase-functions”模块的Cloud Functions中运行的代码才能访问这些变量。

相反,您应该使用gcloud as documented here设置Cloud Run环境。