Interface and Operations / Environment Variables
When users want code to run in a way that reads configurations, in addition to directly writing the configurations in the code, a better approach is to use the "Environment Variables" feature provided by DataFlux Func.
Using environment variables can prevent exporting sensitive configuration information together when exporting scripts
Environment Variable List
In the left sidebar, select the "Environment Variables" tab to display the list of all added environment variables.
Using Environment Variables
After normally adding environment variables, you can use the environment variable ID in scripts to obtain the corresponding value of the environment variable.
Moreover, the system will automatically convert it into the corresponding Python object based on the specified "Value Type", without needing additional type conversion processing in the code.
Assuming there is an ID some_config
, the code for obtaining this environment variable's value is as follows:
Python | |
---|---|
1 |
|
You can also directly copy the basic example code from the environment variable pop-up window to reduce keyboard input:
Reference Documentation
For details on how to use environment variables in scripts, please refer to the documentation Script Development / Environment Variables DFF.ENV