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 their configured ID to obtain the corresponding environment variable value.

Example code:

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

company_name = DFF.ENV('nonExistentEnvVar')
# None

If a type is specified when configuring the environment variable, it will be automatically converted to that specific type when retrieved, eliminating the need for additional type conversion.

However, since type conversion may fail due to configuration errors, for program robustness, default value handling should be added, for example:

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