Compare commits
2 Commits
a08dc4f175
...
32055ecdec
Author | SHA1 | Date | |
---|---|---|---|
|
32055ecdec | ||
|
dabc94b8b5 |
@ -8,7 +8,7 @@
|
||||
If the server runs under https://example.com/schafkopf
|
||||
then apiPath = "/schafkopf"
|
||||
*/
|
||||
const apiPath = "/schafkopf"
|
||||
const apiPath = ""
|
||||
|
||||
var useEnglishTexts = false
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"serverPort": 8000,
|
||||
"production": false,
|
||||
"mail": {
|
||||
"serverDomain": "https://example.com/schafkopf",
|
||||
"emailHostname": "example.com",
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user