Skip to content

Script Development / Environment Variable DFF.ENV

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

Example code is as follows:

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

company_name = DFF.ENV('Not exist environment variable')
# None

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

However, due to possible configuration errors, type conversion may fail, so for program robustness, default value handling should be included, 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