Specify production setting in configuration
This commit is contained in:
parent
e3bdf40b13
commit
f020c13739
@ -6,6 +6,13 @@ struct Configuration {
|
|||||||
|
|
||||||
let mail: EMail
|
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 {
|
struct EMail {
|
||||||
|
|
||||||
/// The url to the root of the server
|
/// The url to the root of the server
|
||||||
|
@ -16,11 +16,10 @@ public func configure(_ app: Application) throws {
|
|||||||
// Set target environment
|
// Set target environment
|
||||||
app.environment = .production
|
app.environment = .production
|
||||||
|
|
||||||
if app.environment == .development {
|
if !configuration.production {
|
||||||
app.logger.logLevel = .info
|
app.logger.logLevel = .info
|
||||||
print("[DEVELOPMENT] Using in-memory database")
|
print("[DEVELOPMENT] Using in-memory database")
|
||||||
app.databases.use(.sqlite(.memory), as: .sqlite)
|
app.databases.use(.sqlite(.memory), as: .sqlite)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
app.logger.logLevel = .notice
|
app.logger.logLevel = .notice
|
||||||
let dbFile = storageFolder.appendingPathComponent("db.sqlite").path
|
let dbFile = storageFolder.appendingPathComponent("db.sqlite").path
|
||||||
|
Loading…
Reference in New Issue
Block a user