简体   繁体   English

设置Firebase环境变量

[英]Setting Firebase environment variables

I have used Heroku and Netlify for storing Firebase environment variables, and it seems pretty straightforward as I can go to the website and enter them manually. 我已经使用Heroku和Netlify来存储Firebase环境变量,并且看起来很简单,因为我可以去网站并手动输入它们。 I was looking around Firebase and it seems a little more complicated. 我正在四处浏览Firebase,似乎有点复杂。 Where does everyone go to for setting environment variables for Firebase? 每个人都去哪里设置Firebase的环境变量? Is there a sure fire way to do it on the website by just entering in the values? 只需输入值,在网站上有没有确定的解决方法? I'm currently messing around with create-react-app. 我目前正在搞混create-react-app。

I know this is a little after the fact but you set firebase environment variables from the command line using 我知道这是事实,但您可以使用以下命令从命令行设置firebase环境变量

firebase functions:config:set someObject.key1="www.api.com" someObject.key2="someOtherKey"

then access them using the firebase-functions npm package 然后使用firebase-functions npm软件包访问它们

var api = functions.config().someObject.key1;

I will happily admit it's nowhere near as simple as the way Heroku/Amazon do it where they just append variables to process.ENV and it can all be configured from a UI 我会很高兴地承认,它远没有Heroku / Amazon那样简单,它们只是将变量附加到process.ENV,而且都可以通过UI进行配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 React 应用程序的 shell 脚本中设置环境变量 - Setting environment variables in a shell script for a React app 使用环境变量设置基本href - Setting base href using Environment variables Firebase 托管是否允许环境变量? - Does Firebase hosting allow environment variables? 从Firebase一次设置多个变量的状态 - Setting state on multiple variables at once from firebase 为每个环境电子反应应用程序设置变量 - Setting variables per environment electron-react app Google App Engine:为 React Production Build 设置环境变量 - Google App Engine: Setting environment variables for React Production Build 在 firebase 配置中反应环境变量错误“意外令牌” - React environment variables error 'Unexpected token' in firebase config Firebase主机如何通过环境变量提供预览通道? - How to provide preview channels on Firebase hosting with environment variables? 在 React Boilerplate 中使用 firebase-messaging-sw.js 中的环境变量 - Utilizing environment variables in firebase-messaging-sw.js in React Boilerplate 为 Azure ABP.IO React 移动应用程序设置环境变量 - Setting up Environment Variables for Azure ABP.IO React Mobile App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM