Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Type Method

load(path:overwrite:)

Reads a dotenv file from the supplied path and loads it into the process.
static func load(path: String, overwrite: Bool = false) async throws

Parameters

path

Absolute or relative path of the dotenv file.

overwrite

If true, values already existing in the process’ env will be overwritten. Defaults to false.

Discussion

try await DotEnvFile.load(path: ".env")
print(Environment.process.FOO) // BAR

Use DotEnvFile.read to read the file without loading it.