Static Methodvapor 4.114.1Vapor

load(path:fileio:on:overwrite:)

Reads a dotenv file from the supplied path and loads it into the process.

DotEnv.swift:151

This declaration is deprecated: Use an async version of load instead

static func load(path: String, fileio: NonBlockingFileIO, on eventLoop: EventLoop, overwrite: Bool = false) -> EventLoopFuture<Void>

Parameters

path

Absolute or relative path of the dotenv file.

fileio

File loader.

eventLoop

Eventloop to perform async work on.

overwrite

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

let fileio: NonBlockingFileIO
let elg: EventLoopGroup
try DotEnvFile.load(path: ".env", fileio: fileio, on: elg.next()).wait()
print(Environment.process.FOO) // BAR

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