Skip to content

Interface and Operations / Environment Variables

When users want their code to run by reading configurations, besides directly writing configurations in 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

Environment Variables 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

After environment variables are normally added, you can use the environment variable ID in the script to obtain the value of the corresponding environment variable.

Furthermore, the system automatically converts the value to the corresponding Python object based on the specified "Value Type", eliminating the need for additional type conversion processing in the code.

env-variable-id.png

Assuming there is an environment variable with ID some_config, 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 specific details on how to use environment variables in scripts, please refer to the documentation Script Development / Environment Variables DFF.ENV