0

I know that I can set enviroment variable with :

firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"

but what i want to do is to change value of the variable when i deploy functions to cloud(production). Basicly i want different value of key for development and production. How can i do it automatically without having to change it manualy every time.

1
  • 1
    This sounds like something you might want to do with a shell script. Commented Aug 26, 2019 at 14:17

1 Answer 1

1

Cloud Functions for Firebase are already built to work this way. If you have a staging project (e.g. myapp-staging) and a production project (e.g. myapp-prod) the Firebase CLI will apply functions config to the currently active project:

# Set the value differently on each project.
firebase functions:config:set --project myapp-staging some.key="STAGING_KEY"
firebase functions:config:set --project myapp-prod some.key="PROD_KEY"

# Deploy to each project, using the values as set
firebase deploy --only functions --project myapp-staging
firebase deploy --only functions --project myapp-prod
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.