diff --git a/Resources/config_example.json b/Resources/config_example.json index 0a2c65a..337d9f3 100644 --- a/Resources/config_example.json +++ b/Resources/config_example.json @@ -1,6 +1,5 @@ { "serverPort": 8000, - "production": false, "mail": { "serverDomain": "https://example.com/schafkopf", "emailHostname": "example.com", diff --git a/Sources/App/Management/Configuration.swift b/Sources/App/Management/Configuration.swift index abf4330..fed8442 100644 --- a/Sources/App/Management/Configuration.swift +++ b/Sources/App/Management/Configuration.swift @@ -6,13 +6,6 @@ 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 diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index 5f93939..371fbcb 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -33,19 +33,17 @@ func configure(_ app: Application) async throws { app.http.server.configuration.port = configuration.serverPort - // Set target environment - app.environment = .production - - if !configuration.production { - app.logger.logLevel = .info + switch app.environment { + case .production: log("[DEVELOPMENT] Using in-memory database") app.databases.use(.sqlite(.memory), as: .sqlite) - } else { + default: app.logger.logLevel = .notice let dbFile = storageFolder.appendingPathComponent("db.sqlite").path log("[PRODUCTION] Using database at \(dbFile)") app.databases.use(.sqlite(.file(dbFile)), as: .sqlite) } + app.migrations.add(UserTableMigration()) app.migrations.add(PasswordResetMigration())