Environment

public struct Environment
extension Environment: Equatable

Manages an application’s Environment such as .production, .development, and .testing. Enables to create a custom Environment and provides access to Environment variables.

  • The name of an Environment.

    Declaration

    Swift

    public let name: String
  • Initializes a new instance of Environment with a name.

    Declaration

    Swift

    public init(name: String = Environment.get("CHAQMOQ_ENV") ?? "")

    Parameters

    name

    The name for a new Environment. Defaults to the Environment variable with the CHAQMOQ_ENV key or falls back to the development Environment if it doesn’t exist or the provided name is empty.

  • Gets an Environment variable by key.

    Declaration

    Swift

    public static func get(_ key: String) -> String?

    Parameters

    key

    A key for an Environment variable.

    Return Value

    An Environment variable if it exists or nil if it doesn’t.

  • An Environment for deploying an application.

    Declaration

    Swift

    public static let production: Environment
  • An Environment for developing an application.

    Declaration

    Swift

    public static let development: Environment
  • An Environment for testing an application.

    Declaration

    Swift

    public static let testing: Environment
  • See Equatable.

    Declaration

    Swift

    public static func == (lhs: Environment, rhs: Environment) -> Bool