Documented the AppArguments protocol and the Environment+Properties extension in the library target.
This commit is contained in:
parent
980c8e15f6
commit
ab4a9207c5
@ -10,11 +10,11 @@ extension App {
|
||||
@Option(name: .shortAndLong)
|
||||
var hostname: String = "127.0.0.1"
|
||||
|
||||
@Option(name: .shortAndLong)
|
||||
var port: Int = 8080
|
||||
|
||||
@Option(name: .shortAndLong)
|
||||
var logLevel: Logger.Level?
|
||||
|
||||
@Option(name: .shortAndLong)
|
||||
var port: Int = 8080
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ extension Environment {
|
||||
|
||||
// MARK: Computed
|
||||
|
||||
/// The logging level set in the environment variables.
|
||||
public var logLevel: String? {
|
||||
self.get("LOG_LEVEL")
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
import Logging
|
||||
|
||||
/// A type that defines the input arguments that the `Hummingbird`app receives.
|
||||
public protocol AppArguments {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// A bind address for the app.
|
||||
var hostname: String { get }
|
||||
/// A logging level to configure for the app.
|
||||
var logLevel: Logger.Level? { get }
|
||||
/// A port for the app to use,
|
||||
var port: Int { get }
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ struct TestArguments: AppArguments {
|
||||
// MARK: Properties
|
||||
|
||||
let hostname = "127.0.0.1"
|
||||
let port = 0
|
||||
let logLevel: Logger.Level? = .trace
|
||||
let port = 0
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user