Interface and Operations / Environment Variables
When users want their code to run by reading configurations, instead of 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 avoid exporting sensitive configuration information along with the script
Environment Variables List
Select the "Environment Variables" tab in the left sidebar to display a list of all added environment variables.
Using Environment Variables
Once environment variables are added normally, you can use the environment variable ID in the script to get the corresponding environment variable value.
Moreover, the system will automatically convert it to the corresponding Python object based on the specified "Value Type", without the need for additional type conversion processing in the code.
Assuming there is an ID some_config
, the code to get the value of this environment variable is as follows:
Python | |
---|---|
1 |
|
You can also directly copy the basic example code in the environment variable prompt box to reduce keyboard input:
Reference Guide
For specific details on how to use environment variables in scripts, refer to the Guide Script Development / Environment Variables DFF.ENV