Skip to content

Commit 6b31675

Browse files
authored
Access logging (#21)
1 parent 5866408 commit 6b31675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+168
-0
lines changed

Sources/Grodt/Application/routes/routes+Dependencies.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func installGlobalMiddleware(_ app: Application) {
195195
let globalRateLimiter = RateLimiterMiddleware(maxRequests: 100, perSeconds: 60)
196196
app.middleware.use(app.sessions.middleware)
197197
app.middleware.use(globalRateLimiter)
198+
app.middleware.use(AccessLogMiddleware(app: app))
198199
}
199200

200201
func scheduleNightlyJobs(_ app: Application, _ container: AppContainer) throws {

Sources/Grodt/Configuration/EnvironmentVariable.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ extension Int: EnvironmentVariableConvertible {
1616
}
1717
}
1818

19+
extension Bool: EnvironmentVariableConvertible {
20+
static func convert(from environmentString: String) -> Bool? {
21+
return environmentString.lowercased() == "true"
22+
}
23+
}
24+
1925
extension Optional<Int>: EnvironmentVariableConvertible {
2026
static func convert(from environmentString: String) -> Optional<Int>? {
2127
return Int(environmentString)

0 commit comments

Comments
 (0)