The ternary operator was introduced in PowerShell 7 whereas 5.1 is the pre-installed version.
Replacing with an if-else (see $metricsEndpoint), or another viable alternative, would increase the compatibility of the script.
log level line
level = "$($env:log_level -eq $null ? 'warn' : $env:log_level)"