Skip to content

Interface and Operations / Environment Variables

When users want their code to run by reading configurations, besides writing the configuration directly into the code, a better approach is to use the "Environment Variables" feature provided by DataFlux Func.

Using environment variables can avoid exporting sensitive configuration information along with the Script when exporting Scripts.

Environment Variable List

Select the "Environment Variables" tab in the left sidebar to display the list of all added environment variables.

env-variable-aside.png

Using Environment Variables

Once environment variables are successfully added, you can use the environment variable ID in the Script to obtain the value of the corresponding environment variable.

Moreover, the system will automatically convert the value into the corresponding Python object according to the specified "Value Type", so there is no need to perform additional type conversion in the code.

env-variable-id.png

Assuming an environment variable with ID some_config exists, the code to obtain its value is as follows:

Python
1
some_config = DFF.ENV('some_config')

You can also directly copy the basic example code from the environment variable prompt box to reduce keyboard input:

env-variable-code-example.png


Reference Documentation

For details on how to use environment variables in Script, refer to the documentation Script Development / Environment Variables DFF.ENV