diff --git a/README.md b/README.md index db5412a..b3f1e4c 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ It allows to define client groups which are all backed up the same way. - Copy the `rustic-scheduler-server` binary to your backup schedule server and the `rustic-scheduler-client` binary to all your clients (available under `/targets/release`). -- Create a config file `rustic_schedulder.toml` on your backup schedule server +- Create a config file `./config/rustic_schedulder.toml` on your backup schedule server (example config is available in the `config/` dir) - Run the `rustic-scheduler-server` binary on your server in the dir containing the config. diff --git a/src/bin/rustic-scheduler-server.rs b/src/bin/rustic-scheduler-server.rs index f7d23cc..f1641f6 100644 --- a/src/bin/rustic-scheduler-server.rs +++ b/src/bin/rustic-scheduler-server.rs @@ -1,5 +1,4 @@ use std::{collections::HashMap, fs::read_to_string, time::Duration}; - use anyhow::Result; use axum::{ extract::{ @@ -15,6 +14,7 @@ use log::warn; use sailfish::TemplateOnce; use tokio::{ spawn, + net::TcpListener, sync::{mpsc, oneshot}, time::sleep, }; @@ -47,7 +47,8 @@ enum NotifyMessage { #[tokio::main] async fn main() { - let config = read_to_string("rustic_scheduler.toml").unwrap(); + // FIXME: Unhardcode config file and expose via CLI settings + let config = read_to_string("./config/rustic_scheduler.toml").unwrap(); let config: ConfigFile = toml::from_str(&config).unwrap(); config.validate().unwrap(); @@ -145,8 +146,13 @@ async fn main() { .with_state(wtx); // run it with hyper on localhost:3012 - axum::Server::bind(&config.global.address.parse().unwrap()) - .serve(app.into_make_service()) + let listener = TcpListener::bind(&config.global.address) + .await + .unwrap(); + + println!("Listening on http://{}", config.global.address); + + axum::serve(listener, app.into_make_service()) .await .unwrap(); }