Interface and Operations / Environment Variables
When users want their code to run by reading configurations, instead of directly embedding the configuration within the code, a better approach is to use the "Environment Variables" feature provided by DataFlux Func.
Using environment variables can prevent sensitive configuration information from being exported together with the script when exporting.
List of Environment Variables
By selecting the "Environment Variables" tab in the left sidebar, you can display a list of all added environment variables.
Using Environment Variables
After adding environment variables correctly, they can be used in scripts by accessing the value of the corresponding environment variable ID.
Additionally, the system will automatically convert the value into the appropriate Python object based on the specified "Value Type," eliminating the need for additional type conversion handling in the code.
Assuming there exists an ID some_config
, the code to retrieve this environment variable's value would look like the following:
Python | |
---|---|
1 |
|
You can also directly copy the basic example code from the environment variable hint box, reducing keyboard input:
Reference Documentation
For more details on how to use environment variables within scripts, refer to the documentation Script Development / Environment Variables DFF.ENV