This repository has been archived on 2021-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
statusboard/Sources/App/configure.swift

22 lines
621 B
Swift
Raw Normal View History

2020-11-11 22:49:55 +00:00
import Vapor
import Leaf
import LeafErrorMiddleware
// configures your application
public func configure(_ app: Application) throws {
2020-11-12 02:11:12 +00:00
app.middleware.use(LeafErrorMiddleware())
2020-11-11 22:49:55 +00:00
// Serve files from /Public
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
2020-11-12 21:23:25 +00:00
app.middleware.use(app.sessions.middleware)
app.sessions.configuration.cookieName = "statusboard_session"
2020-11-11 22:49:55 +00:00
// Configure Leaf
LeafOption.caching = app.environment.isRelease ? .default : .bypass
2020-11-11 23:58:42 +00:00
LeafRenderer.Option.timeout = 200.0
2020-11-11 22:49:55 +00:00
app.views.use(.leaf)
// Register routes
try routes(app)
}