Home > Enterprise >  Firebase functions - is it possible to deploy functions:config variables without depoying all the fu
Firebase functions - is it possible to deploy functions:config variables without depoying all the fu

Time:07-27

I have added a new environment variable to the functions:config. I have some cloud functions that are not ready to be deployed to production yet.

How can I deploy the env variable without deploying all the functions?

It tells me to use:

firebase deploy --only functions

CodePudding user response:

What you're trying to do is not possible. The functions config env vars are essentially part of each individual function's deployment. They don't exist separately from the function - they are part of the function and are packaged up along with it when you deploy.

To put it another way, you can think of the vars as part of the code of your function. If you change the code or vars at all, the entire thing needs to be redeployed.

CodePudding user response:

I am going to assume the reason you are trying to do this is to segregate your dev and prod env variables.

Firebase now supports .env, .env.prod, .env.dev files natively!

Documentation: https://firebase.google.com/docs/functions/config-env

You can create your env files and then use firebase use dev or firebase use prod before you deploy.

These variables can be accessed via process.env.VARIABLE_NAME

Hope this helps.

  • Related