Type Method
load(path:fileio:overwrite:)
Reads a dotenv file from the supplied path and loads it into the process.
static func load(path: String, fileio: NonBlockingFileIO, overwrite: Bool = false) async throws
Parameters
pathAbsolute or relative path of the dotenv file.
fileioFile loader.
overwriteIf
true, values already existing in the process’ env will be overwritten. Defaults tofalse.
Discussion
let fileio: NonBlockingFileIO
try await DotEnvFile.load(path: ".env", fileio: fileio)
print(Environment.process.FOO) // BAR
Use DotEnvFile.read to read the file without loading it.