From baf3a1c06dac23a80e681e8e6f3d740fb57035bd Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Sun, 4 Sep 2022 17:09:51 +0200 Subject: [PATCH] Show config error as status --- Sources/App/ServerStatus.swift | 2 ++ Sources/App/configure.swift | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/App/ServerStatus.swift b/Sources/App/ServerStatus.swift index 93bfcb0..c19e1ae 100644 --- a/Sources/App/ServerStatus.swift +++ b/Sources/App/ServerStatus.swift @@ -9,4 +9,6 @@ enum ServerStatus: Int, Codable { case pushFailed = 2 case starting = 3 + + case failedToStart = 4 } diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index bbcef50..4f00e12 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -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 }