Compare commits

..

No commits in common. "32055ecdec1d89f20d9aa71dd125eccde0070b57" and "a08dc4f175b27422366ccb9e82dee23a8ccd84ad" have entirely different histories.

4 changed files with 15 additions and 5 deletions

View File

@ -8,7 +8,7 @@
If the server runs under https://example.com/schafkopf
then apiPath = "/schafkopf"
*/
const apiPath = ""
const apiPath = "/schafkopf"
var useEnglishTexts = false

View File

@ -1,5 +1,6 @@
{
"serverPort": 8000,
"production": false,
"mail": {
"serverDomain": "https://example.com/schafkopf",
"emailHostname": "example.com",

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

@ -33,17 +33,19 @@ func configure(_ app: Application) async throws {
app.http.server.configuration.port = configuration.serverPort
switch app.environment {
case .production:
// Set target environment
app.environment = .production
if !configuration.production {
app.logger.logLevel = .info
log("[DEVELOPMENT] Using in-memory database")
app.databases.use(.sqlite(.memory), as: .sqlite)
default:
} else {
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())