Skip to content

Commit 3d84916

Browse files
authored
fix: show actual bind address in Web UI log message (#4897)
1 parent c6988fd commit 3d84916

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/confighttp.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,11 +1793,15 @@ namespace confighttp {
17931793
server.config.address = net::get_bind_address(address_family);
17941794
server.config.port = port_https;
17951795

1796+
// Store bind address for logging, use "localhost" as fallback for wildcard addresses
1797+
const auto bind_addr = server.config.address;
1798+
const auto display_addr = config::sunshine.bind_address.empty() ? "localhost"sv : std::string_view {bind_addr};
1799+
17961800
auto accept_and_run = [&](auto *server) {
17971801
try {
17981802
platf::set_thread_name("confighttp::tcp");
1799-
server->start([](const unsigned short port) {
1800-
BOOST_LOG(info) << "Configuration UI available at [https://localhost:"sv << port << "]";
1803+
server->start([&display_addr](const unsigned short port) {
1804+
BOOST_LOG(info) << "Configuration UI available at [https://"sv << display_addr << ":" << port << "]";
18011805
});
18021806
} catch (boost::system::system_error &err) {
18031807
// It's possible the exception gets thrown after calling server->stop() from a different thread

0 commit comments

Comments
 (0)