Error
Environment.swift:38struct Error
struct Error
import Hummingbird
struct Environment
Access environment variables
init()
Initialize from environment variables
init(dictionaryLiteral elements: (String, String)...)
Initialize from dictionary literal
init(from decoder: Decoder) throws
Initialize from Decodable
init(values: [String : String])
Initialize from dictionary
static func dotEnv(_ dovEnvPath: String = ".env") async throws -> Environment
Create Environment initialised from the .env
file
var description: String { get }
func get(_ s: String) -> String?
Get environment variable with name
func get<T>(_ s: String, as: T.Type) -> T? where T : LosslessStringConvertible
Get environment variable with name as a certain type
func merging(with env: Environment) -> Environment
Merge two environment variable sets together and return result
func require(_ s: String) throws -> String
Require environment variable with name
func require<T>(_ s: String, as: T.Type) throws -> T where T : LosslessStringConvertible
Require environment variable with name as a certain type
mutating func set(_ s: String, value: String?)
Set environment variable
protocol Equatable
A type that can be compared for value equality.
protocol Error : Sendable
A type representing an error value that can be thrown.
protocol Sendable
static var dotEnvParseError: Self { get }
Error while parsing dot env file
static var variableDoesNotConvert: Self { get }
Required variable does not convert to type
static var variableDoesNotExist: Self { get }
Required variable does not exist
let message: String?
static func == (lhs: Self, rhs: Self) -> Bool
var localizedDescription: String { get }
Retrieve the localized description for this error.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.