Configuration file

Implement the configuration of your function.

Every function has its own configuration file, e.g., functions/myFirstFunction/function.config.json. This file is a descriptor of the function myFirstFunction.

Here is an example of a function.config.json file:

{
    "name": "sendSignUpWelcomeEmail",
    "description": "Send a welcome email when users sign up throughout a SendGrid template.",
    "tags": [ "sendGrid", "sign up", "email"],
    "trigger": {
        "provider": "auth",
        "event": "user.create"
    },
    "env": [
        {
            "name": "SENDGRID_API_KEY",
            "description": "The API key to authenticate access to SendGrid services.",
            "required": true
        },
        {
            "name": "SENDGRID_SENDER_EMAIL",
            "description": "Email corresponding to SendGrid sender correctly verified.",
            "required": true
        },
        {
            "name": "SENDGRID_TEMPLATE_ID",
            "description": "The ID of SendGrid dynamic template that will be used to generate the welcome email.",
            "required": true
        }
    ]
}

Let's go through all the properties of the function.config.json

  • name: The name of your function. It should be in camelCase.

  • description: A short description of your function. It will be displayed on the function card in the Marketplace.

  • tags: List of tags used for search on the Marketplace. Maximum 3 tags per function.

  • trigger: It's the trigger descriptor. It will match with all the Firebase event triggers.

  • env: Contains the list of environment variables that your function implementation needs to work. It's one of the dynamic elements to make your function more general.

Last updated