Fix production detection

This commit is contained in:
Christoph Hagen 2023-12-25 19:17:16 +01:00
parent 10194066db
commit 479635344d

View File

@ -36,14 +36,14 @@ func configure(_ app: Application) async throws {
switch app.environment {
case .production:
log("[DEVELOPMENT] Using in-memory database")
app.databases.use(.sqlite(.memory), as: .sqlite)
default:
app.logger.logLevel = .notice
let dataDirectory = configuration.customDataDirectory(or: publicDirectory)
let dbFile = dataDirectory.appendingPathComponent("db.sqlite").path
log("[PRODUCTION] Using database at \(dbFile)")
app.databases.use(.sqlite(.file(dbFile)), as: .sqlite)
default:
log("[DEVELOPMENT] Using in-memory database")
app.databases.use(.sqlite(.memory), as: .sqlite)
}
app.migrations.add(UserTableMigration())