diff --git a/src/bin/taskchampion-sync-server.rs b/src/bin/taskchampion-sync-server.rs index 3de9157..9b1efef 100644 --- a/src/bin/taskchampion-sync-server.rs +++ b/src/bin/taskchampion-sync-server.rs @@ -36,6 +36,10 @@ async fn main() -> anyhow::Result<()> { .value_parser(value_parser!(u16)) .default_value(defaults.port.to_string()), ) + .arg( + arg!(--host
"On what address to host server") + .default_value("localhost"), + ) .arg( arg!(--"snapshot-versions" "Target number of versions between snapshots") .value_parser(value_parser!(u32)) @@ -75,6 +79,7 @@ async fn main() -> anyhow::Result<()> { } }, None => { + let host: &String = matches.get_one("host").unwrap(); let port: u16 = *matches.get_one("port").unwrap(); let snapshot_versions: u32 = *matches.get_one("snapshot-versions").unwrap(); let snapshot_days: i64 = *matches.get_one("snapshot-days").unwrap(); @@ -85,13 +90,13 @@ async fn main() -> anyhow::Result<()> { let server = Server::new(config, Box::new(storage)); - log::warn!("Serving on port {}", port); + log::info!("Serving on {}:{}", host, port); HttpServer::new(move || { App::new() .wrap(Logger::default()) .configure(|cfg| server.config(cfg)) }) - .bind(format!("0.0.0.0:{}", port))? + .bind(format!("{}:{}", host, port))? .run() .await?; },