Show config error as status
This commit is contained in:
parent
ec0b94ee39
commit
baf3a1c06d
@ -9,4 +9,6 @@ enum ServerStatus: Int, Codable {
|
|||||||
case pushFailed = 2
|
case pushFailed = 2
|
||||||
|
|
||||||
case starting = 3
|
case starting = 3
|
||||||
|
|
||||||
|
case failedToStart = 4
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,14 @@ public func configure(_ app: Application) throws {
|
|||||||
let data = try Data(contentsOf: configUrl)
|
let data = try Data(contentsOf: configUrl)
|
||||||
config = try JSONDecoder().decode(from: data)
|
config = try JSONDecoder().decode(from: data)
|
||||||
} catch {
|
} catch {
|
||||||
print("Failed to load config: \(error)")
|
print("Failed to load config from \(configUrl.path): \(error)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
app.http.server.configuration.port = config.port
|
app.http.server.configuration.port = config.port
|
||||||
|
|
||||||
guard configureAPNS(config) else {
|
guard configureAPNS(config) else {
|
||||||
|
serverStatus = .failedToStart
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user