EnvReader

interface EnvReader(source)

A functional interface for reading environment variables.

Implementations of this interface are responsible for reading environment variables from a specific source, such as system properties or a .env file.

Inheritors

Functions

Link copied to clipboard
Returns the default EnvReader, which reads from the system environment.
Link copied to clipboard
open fun priority(readers: Array<EnvReader>): EnvReader
Creates a new EnvReader that reads from multiple sources in order, returning the first value found.
Link copied to clipboard
abstract fun <T> read(key: String, targetType: Class<T>): Optional<T>
Reads an environment variable and converts it to the specified type.
open fun <T> read(key: String, targetType: Class<T>, defaultValue: T): T
Reads an environment variable and converts it to the specified type, returning a default value if the variable is not set.