Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch configuration and log actual port on startup (#3160)
* Log actual port on startup Before this change, the application ```swift let app = Application(.testing) defer { app.shutdown() } try app.server.start(hostname: nil, port: 0) defer { app.server.shutdown() } ``` would log the following message *before* starting the server: ``` [Vapor] Server starting on http://127.0.0.1:0 ``` After this change it instead logs a message like the following *after* starting the server: ``` [Vapor] Server started on [IPv4]127.0.0.1/127.0.0.1:57935 ``` * Avoid changing log format * Log both before and after starting * Make 'addressDescription' a computed property Just invoking the property twice seemed cleaner to me compared to duplicating the code block. Fixed a little indentation issue in the process I don't know if it's ever relevant, but config is now patched on all address types, including unix socket. * Remove obsolete variable * Make 'addressDescription' internal * Add test * Fix broken test --------- Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
56 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters