Skip to content

Instantly share code, notes, and snippets.

@Tittoh
Last active November 15, 2020 08:33
Show Gist options
  • Select an option

  • Save Tittoh/7060e14c8893cc8067b9014deb8e842e to your computer and use it in GitHub Desktop.

Select an option

Save Tittoh/7060e14c8893cc8067b9014deb8e842e to your computer and use it in GitHub Desktop.
Firebase environment variables. Firebase cloud functions provide a way to set and access env variables.

Its never a good idea to have sensitive data like API keys in plain site.

Set env variable

firebase functions:config:set my.secret='giraffes are cool'

Note that each config value must have a 2-part key (e.g. foo.bar) otherwise it will fail.

Deploy your functions for the change to take effect

firebase deploy --only functions

Access env variable

const secret = firebase.config().my.secret

Now you know 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment