PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 5, 2022

[FIXED] How to change a environmental variable (functions.config()) of a firebase function, without redeploying the function from the cli

 November 05, 2022     environment-variables, firebase, google-cloud-functions, google-cloud-platform, javascript     No comments   

Issue

I'm trying to use a functions.config() variable of the firebase functions environment, to be able to switch logs on/off depending on, whether this variable is set to true/false. I have already created it, but it seems based on info from the following link (https://firebase.google.com/docs/functions/config-env#additional_environment_commands), that you can change it only if you redeploy the function, after you have used the firebase functions:config:set command to change the environmental variable first.

It appears that it could be achieved though, by using gcloud functions commands for deploying the function (gcloud deploy and not firebase deploy), with the --set-env-vars command (and different syntax to access the env. variable). Then this environmental variable can be changed easily by just changing value of the variable by navigating to the specific function at GCP console, and then by going to EDIT -> MORE and changing Environment variables at the bottom. source:
https://cloud.google.com/functions/docs/env-var

So my question is the following: Is there a similar way to change a firebase functions.config() variable without redeploying the function from the cli?


Solution

Update: (credit to Doug Stevenson) Apparantly the only way to change the environment variable is to do a deploy.

Original answer: You can do it the same way. Basically every Firebase Cloud Function is a Google Cloud Function and can be accessed the same way from the GCP console. Every Firebase Cloud Function is also present in the GCP console, and there you can easily just edit the environment variables just as you described in your question)



Answered By - Andrii Rudavko
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing