Skip to content

Script Development / Environment Variables DFF.ENV

All environment variables configured in the left sidebar of the script editor can be accessed in the script using the configured ID to get the corresponding environment variable value.

Example code:

Python
1
2
3
4
5
company_name = DFF.ENV('companyName')
# 'My Company'

company_name = DFF.ENV('Non-existent Environment Variable')
# None

If the environment variable is specified with a type during configuration, it will be automatically converted to the specific type when retrieved, without the need for additional type conversion.

However, since type conversion might fail due to configuration errors, for the robustness of the program, default value handling should be added, such as:

Python
1
2
3
4
5
page_size = 10
try:
    page_size = DFF.ENV('pageSize') or page_size
except Exception as e:
    pass