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
Structures
Environment.ProcessThe process information of an environment. WrapsProcessInto.processInfo.
Operators
==(_:_:)SeeEquatable
Initializers
init(name:arguments:)Create a newEnvironment.
Instance Properties
argumentsThe command-line arguments for thisEnvironment.commandInputExposes theEnvironment’sargumentsproperty as aCommandInput.isReleasetrueif this environment is meant for production use cases.nameThe environment’s unique name.
Type Properties
developmentAn environment for developing your application.processThe current process of the environment.productionAn environment for deploying your application to consumers.testingAn environment for testing your application.
Type Methods
custom(name:)Creates a custom environment.detect(arguments:)Detects the environment fromCommandLine.arguments. Invokesdetect(from:).detect(from:)Detects the environment fromCommandInput. Parses the--envflag, with theVAPOR_ENVenvironment variable as a fallback.get(_:)Gets a key from the process environmentsecret(key:)Reads a file’s content for a secret. The secret key is the name of the environment variable that is expected to specify the path of the file containing the secret.secret(key:fileIO:on:)Reads a file’s content for a secret. The secret key is the name of the environment variable that is expected to specify the path of the file containing the secret.secret(path:)Load the content of a file at a given path as a secret.secret(path:fileIO:on:)Load the content of a file at a given path as a secret.
Relationships
Conforms To
Swift.EquatableSwift.SendableSwift.SendableMetatype