Specify production setting in configuration

This commit is contained in:
Christoph Hagen 2022-10-13 12:25:51 +02:00
parent e3bdf40b13
commit f020c13739
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,13 @@ struct Configuration {
let mail: EMail
/**
Use a database file and reduce logging.
If this property is set to `false`, then an in-memory database is used with increased logging.
*/
let production: Bool
struct EMail {
/// The url to the root of the server

View File

@ -16,11 +16,10 @@ public func configure(_ app: Application) throws {
// Set target environment
app.environment = .production
if app.environment == .development {
if !configuration.production {
app.logger.logLevel = .info
print("[DEVELOPMENT] Using in-memory database")
app.databases.use(.sqlite(.memory), as: .sqlite)
} else {
app.logger.logLevel = .notice
let dbFile = storageFolder.appendingPathComponent("db.sqlite").path