Type "number"

If you are writing a function that requires enter numeric values, you can use environment variables of type number in your implementation. Then our platform will ask consumers to enter their value during installation.

The type number variables allow consumers of a function to enter only numeric values. It is displayed in the installation UI form as an input number element (see image below).

Example of a type "number" environment variable definition

"env": [
    {
        "name": "SCALE",
        "description": "The number of pixels to which you want to set the selected dimension.",
        "required": true,
        "type": "number",
        "default": 20,
        "min": 1,
        "max": 100
    }
]

Example of how to consume the value of the environment variable within the function implementation

const myFunction = () => {
    const scale = Number(process.env.SCALE);
    ...
};

module.exports = myFunction;

Properties of the type

property

type

required

default

description

name

string

yes

-

The name of the environment variable. This should be unique for each variable.

description

string

no

-

The description of the environment variable.

default

number

no

-

The default value for the variable.

required

bool

no

false

Specifies that a variable must be filled out before submitting.

min

number

no

-

Specifies the minimum value allowed.

max

number

no

-

Specifies the maximum value allowed.

Last updated