getEnv

Allows to override static values with environment variables.

The modifier checks if the variable given as its argument is set and reads the value if so, overriding any existing value. If the environment variable is not set, the variable given on the left-hand side of the expression is not changed.

To have a value actually inserted, your PHP execution environment (webserver, PHP-FPM) needs to have these variables set, or you need a mechanism like dotenv (for example: symfony/dotenv or vlucas/phpdotenv) to set them in your running TYPO3.

As it is a syntax feature you can use it in both constants and setup plus it gets cached, as opposed to the getText.getenv feature.

Example

EXT:site_package/Configuration/TypoScript/setup.typoscript
# Define default value
myConstant = defaultValue
# Enable overriding by environment variable
myConstant := getEnv(TS_MYCONSTANT)