read(path:fileio:on:)
Reads a dotenv file from the supplied path.
This declaration is deprecated: Migrate to async API
static func read(path: String, fileio: NonBlockingFileIO, on eventLoop: EventLoop) -> EventLoopFuture<DotEnvFile>
Parameters
let fileio: NonBlockingFileIO
let elg: EventLoopGroup
let file = try DotEnvFile.read(path: ".env", fileio: fileio, on: elg.next()).wait()
for line in file.lines {
print("\(line.key)=\(line.value)")
}
file.load(overwrite: true) // loads all lines into the process
print(Environment.process.FOO) // BAR
Use DotEnvFile.load
to read and load with one method.