Skip to content

Commit 35426c3

Browse files
authored
Merge pull request #1854 from Zentrik/patch-1
Print correct port in startup message
2 parents b00915b + e87e46e commit 35426c3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

site/src/main.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ async fn main() {
2424
eprintln!("Defaulting to loading from `results.db`");
2525
String::from("results.db")
2626
});
27+
let port = env::var("PORT")
28+
.ok()
29+
.and_then(|x| x.parse().ok())
30+
.unwrap_or(2346);
2731
let fut = tokio::task::spawn_blocking(move || {
2832
tokio::task::spawn(async move {
2933
let res = Arc::new(load::SiteCtxt::from_db_url(&db_url).await.unwrap());
@@ -38,17 +42,15 @@ async fn main() {
3842
"Loading complete; {} commits and {} artifacts",
3943
commits, artifacts,
4044
);
41-
eprintln!("View the results in a web browser at 'http://localhost:2346/compare.html'");
45+
eprintln!(
46+
"View the results in a web browser at 'http://localhost:{port}/compare.html'"
47+
);
4248
// Spawn off a task to post the results of any commit results that we
4349
// are now aware of.
4450
site::github::post_finished(&res).await;
4551
})
4652
})
4753
.fuse();
48-
let port = env::var("PORT")
49-
.ok()
50-
.and_then(|x| x.parse().ok())
51-
.unwrap_or(2346);
5254
println!("Starting server with port={:?}", port);
5355

5456
let server = site::server::start(ctxt, port).fuse();

0 commit comments

Comments
 (0)