Skip to content

Commit 231216a

Browse files
committed
fix incorrect console message at start
SQLPage listens on all public interfaces by default, so it is accessible by other computers on the same network. This used to be hidden in log messages, make it obvious instead. fixes #387
1 parent 8a8b755 commit 231216a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/main.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ async fn start() -> anyhow::Result<()> {
2828
async fn log_welcome_message(config: &AppConfig) {
2929
let address_message = if let Some(unix_socket) = &config.unix_socket {
3030
format!("unix socket {unix_socket:?}")
31+
} else if let Some(domain) = &config.https_domain {
32+
format!("https://{}", domain)
3133
} else {
32-
// Don't show 0.0.0.0 as the host, show the actual IP address
33-
let http_addr = config.listen_on().to_string().replace(
34-
"0.0.0.0",
35-
std::net::IpAddr::V4(std::net::Ipv4Addr::LOCALHOST)
36-
.to_string()
37-
.as_str(),
38-
);
39-
if let Some(domain) = &config.https_domain {
40-
format!("https://{}", domain)
34+
let listen_on = config.listen_on();
35+
let msg = if listen_on.ip().is_unspecified() {
36+
// let the user know the service is publicly accessible
37+
" (accessible on all networks of this computer)"
4138
} else {
42-
format!("http://{}", http_addr)
43-
}
39+
""
40+
};
41+
format!("http://{listen_on}{msg}")
4442
};
4543

4644
log::info!(

0 commit comments

Comments
 (0)