read

open fun <T> read(key: String, targetType: Class<T>): Optional<T>(source)

Reads an environment variable from the configured sources in order, returning the first value found.

Return

an Optional containing the value of the environment variable, or empty if the variable is not found in any of the sources

Parameters

key

the name of the environment variable

targetType

the type to convert the value to