firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Skip creating env variables with undefined values

Open aalej opened this issue 1 year ago • 0 comments

Description

Fixes #7036. From what I can gather, it is possible that env values can be undefined.

I think we should skip the creation of env if their value is undefined.

Scenarios Tested

  1. Run firebase functions:config:set test.user=test-user
  2. Run firebase functions:config:set some.random.planet=
    • Creates an env with no value
  3. Run `
    • Outputs the ff JSON object, where some.random doesn't have a value
{
  "some": {
    "random": {}
  },
  "test": {
    "user": "test-user"
  }
  1. Run firebase functions:config:export
i  Importing functions configs from projects [PROJECT_ID]
i  Importing configs from projects: [PROJECT_ID]
✔  Wrote functions/.env.default
✔  Wrote functions/.env.local
✔  Wrote functions/.env

The ff files are created:

.env

# Exported firebase functions:config:export command on 4/25/2024# .env file contains environment variables that applies to all projects.

.env.default

# Exported firebase functions:config:export command on 4/25/2024
TEST_USER="test-user" # from test.user

.env.local

# Exported firebase functions:config:export command on 4/25/2024
# .env.local file contains environment variables for the Functions Emulator.

aalej avatar Apr 25 '24 14:04 aalej