Firebase Cloud Function for Pikobar's Firebase project.
https://firebase.google.com/docs/functions/get-started
https://firebase.google.com/docs/functions/local-emulator
For example, we want to add a key-value pair named myVar:myValue
.
- Edit
env.json
, add the key-value pair
{
..., //other key-value pairs
"myVar": "myValue"
}
- Unset existing env variables
firebase functions:config:unset env
- Set the new env variables
firebase functions:config:set env="$(cat env.json)"
- Use the env variables
const value = functions.config().env.myVar; //value contains 'myValue'
We can use nested variables. See updateStatistics
variable in env.json
for example.