arguments
The command-line arguments for this Environment
.
var arguments: [String]
The command-line arguments for this Environment
.
var arguments: [String]
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct Environment
The environment the application is running in, i.e., production, dev, etc. All Container
s will have an Environment
that can be used to dynamically register and configure services.
@frozen struct String
A Unicode string value that is a collection of characters.
init(name: String, arguments: [String] = ProcessInfo.processInfo.arguments)
Create a new Environment
.
static var development: Environment { get }
An environment for developing your application.
static var process: Process { get }
The current process of the environment.
static var production: Environment { get }
An environment for deploying your application to consumers.
static var testing: Environment { get }
An environment for testing your application.
static func custom(name: String) -> Environment
Creates a custom environment.
static func detect(arguments: [String] = ProcessInfo.processInfo.arguments) throws -> Environment
Detects the environment from CommandLine.arguments
. Invokes detect(from:)
.
static func detect(from commandInput: inout CommandInput) throws -> Environment
Detects the environment from CommandInput
. Parses the --env
flag, with the VAPOR_ENV
environment variable as a fallback.
static func get(_ key: String) -> String?
Gets a key from the process environment
static func secret(key: String) async throws -> String?
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.
static func secret(path: String) async throws -> String?
Load the content of a file at a given path as a secret.
var commandInput: CommandInput { get set }
Exposes the Environment
’s arguments
property as a CommandInput
.
var isRelease: Bool { get }
true
if this environment is meant for production use cases.
let name: String
The environment’s unique name.
static func == (lhs: Environment, rhs: Environment) -> Bool
See Equatable
@dynamicMemberLookup struct Process
The process information of an environment. Wraps ProcessInto.processInfo
.
static func secret(key: String, fileIO: NonBlockingFileIO, on eventLoop: EventLoop) -> EventLoopFuture<String?>
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.
static func secret(path: String, fileIO: NonBlockingFileIO, on eventLoop: EventLoop) -> EventLoopFuture<String?>
Load the content of a file at a given path as a secret.