Show config error as status

This commit is contained in:
Christoph Hagen 2022-09-04 17:09:51 +02:00
parent ec0b94ee39
commit baf3a1c06d
2 changed files with 4 additions and 1 deletions

View File

@ -9,4 +9,6 @@ enum ServerStatus: Int, Codable {
case pushFailed = 2
case starting = 3
case failedToStart = 4
}

View File

@ -23,13 +23,14 @@ public func configure(_ app: Application) throws {
let data = try Data(contentsOf: configUrl)
config = try JSONDecoder().decode(from: data)
} catch {
print("Failed to load config: \(error)")
print("Failed to load config from \(configUrl.path): \(error)")
return
}
app.http.server.configuration.port = config.port
guard configureAPNS(config) else {
serverStatus = .failedToStart
return
}