Firebase 云函数 process.env 变量可以从 GUI 设置,但不能从 CLI 设置? [英] Firebase cloud function process.env variables can be set from GUI but not from CLI?

查看:19
本文介绍了Firebase 云函数 process.env 变量可以从 GUI 设置,但不能从 CLI 设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从

解决方案

Firebase 不直接支持设置进程环境变量.目前,在部署时提供配置的唯一方法是使用不同类型的 环境配置,这与您在屏幕截图中显示的进程环境变量并不完全相同.

如果您想为使用 Firebase CLI 部署的函数设置流程环境变量,则必须使用您已经发现的方法.如果您想在部署时设置它们,则必须改用 Google Cloud 的命令行gcloud",这意味着您根本无法利用 firebase-functions API 或 Firebase CLI.你只需要在两者之间做出选择.

I can create process.env variables from https://console.cloud.google.com/functions but I've to create this variables for each and every firebase cloud functions which is inefficient.

How can I create these process.env variables from code? while deploying cloud functions from my machine? If I can set it up from GUI then there must be a way to set it up from CLI/code.

解决方案

Firebase does not directly support setting process environment variables. Currently, the only way to provide configuration at the time of deployment is using a different kind of environment configuration, which is not really the same as process env vars that you're showing in the screenshot.

If you want to set process environment variable for functions deployed with the Firebase CLI, you will have to use the method that you've already discovered. If you want to set them at the time of deployment, you will have to use Google Cloud's command line "gcloud" instead, which means you won't be able to take advantage of the firebase-functions API or the Firebase CLI at all. You just have to choose between the two.

这篇关于Firebase 云函数 process.env 变量可以从 GUI 设置,但不能从 CLI 设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆