且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Firebase托管的应用程序中引用Firebase Functions配置变量?

更新时间:2023-09-08 22:09:40

通过提供的链接定义的变量仅可通过Cloud Functions使用.它们不能直接用于Firebase Hosting提供的静态内容.

The variables you define through the link you provided are only available via Cloud Functions. They're not made available directly to the static content served by Firebase Hosting.

如果需要,可以使HTTP函数不执行任何操作,只从环境变量中返回JSON,然后从Web内容中调用它.请记住,您正在向世界公开您的秘密密钥.

If you want, you can make an HTTP function that does nothing but return the JSON from your env vars, and call that from your web content. Bear in mind that you're exposing your secret keys to the world.