Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch configuration and log actual port on startup #3160

Merged
merged 12 commits into from Apr 26, 2024
15 changes: 3 additions & 12 deletions Sources/Vapor/HTTP/Server/HTTPServer.swift
Expand Up @@ -308,18 +308,6 @@ public final class HTTPServer: Server, Sendable {
configuration.address = address!
}

/// Print starting message.
let scheme = configuration.tlsConfiguration == nil ? "http" : "https"
let addressDescription: String
switch configuration.address {
case .hostname(let hostname, let port):
addressDescription = "\(scheme)://\(hostname ?? configuration.hostname):\(port ?? configuration.port)"
case .unixDomainSocket(let socketPath):
addressDescription = "\(scheme)+unix: \(socketPath)"
}

self.configuration.logger.notice("Server starting on \(addressDescription)")
bisgardo marked this conversation as resolved.
Show resolved Hide resolved

/// Start the actual `HTTPServer`.
try self.connection.withLockedValue {
$0 = try HTTPServerConnection.start(
Expand All @@ -331,6 +319,9 @@ public final class HTTPServer: Server, Sendable {
).wait()
}

/// Print starting message.
bisgardo marked this conversation as resolved.
Show resolved Hide resolved
configuration.logger.notice("Server started on \(self.localAddress!.description)")
bisgardo marked this conversation as resolved.
Show resolved Hide resolved

self.configuration = configuration
self.didStart.withLockedValue { $0 = true }
}
Expand Down