Structure
Environment
The environment the application is running in, i.e., production, dev, etc. All
Containers will have an Environment that can be used to dynamically register and configure services.struct Environment
Overview
switch env {
case .production:
app.http.server.configuration = ...
default: break
}
The Environment can also be used to retrieve variables from the Process’ ENV.
print(Environment.get("DB_PASSWORD"))
Topics
Operators
Initializers
init(name: String)Create a newEnvironment.
Instance Properties
var isRelease: Booltrueif this environment is meant for production use cases.let name: StringThe environment’s unique name.
Type Properties
static var development: EnvironmentAn environment for developing your application.static var production: EnvironmentAn environment for deploying your application to consumers.static var testing: EnvironmentAn environment for testing your application.
Type Methods
static func custom(name: String) -> EnvironmentCreates a custom environment.static func detect(from: ConfigReader) throws -> EnvironmentDetects the environment fromConfigReader. Parses thevapor.envflag.
Default Implementations
Relationships
Conforms To
Configuration.ExpressibleByConfigStringSwift.CopyableSwift.CustomStringConvertibleSwift.EquatableSwift.EscapableSwift.SendableSwift.SendableMetatype