Set a variable as an array using Firebase CLI

If you want to set a variable as array using Firebase CLI:

terminal
firebase functions:config:set admin.ids.0="1234" admin.ids.1="4567"

Be aware of the key=val format (without spaces). Otherwise, you'll get a 400 error.

Check if the configuration is correct:

terminal
firebase functions:config:get

Result:

terminal
{
    "admin": {
        "ids: ["1234","4567"]
    }
}

Let's assume that, at this point, you want to add another value to the array.

Intuitively:

terminal
firebase functions:config:set admin.ids.2="8910"

Result:

terminal
{
    "admin": {
        "ids: ["1234","4567","8910"]
    }
}

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.