diff --git a/src/config.rs b/src/config.rs index f41b201..15416fb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,12 @@ use rustical_auth::{AuthProvider, HtpasswdAuthConfig}; use serde::{Deserialize, Serialize}; +#[derive(Debug, Deserialize, Serialize)] +pub struct HttpConfig { + pub host: String, + pub port: u16, +} + #[derive(Debug, Deserialize, Serialize)] pub struct TomlCalendarStoreConfig { pub db_path: String, @@ -40,4 +46,5 @@ impl From for AuthProvider { pub struct Config { pub calendar_store: CalendarStoreConfig, pub auth: AuthConfig, + pub http: HttpConfig, } diff --git a/src/main.rs b/src/main.rs index 9884ba7..861221b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,7 +69,7 @@ async fn main() -> Result<()> { web::scope("/api").configure(|cfg| configure_api(cfg, cal_store.clone().into())), ) }) - .bind(("0.0.0.0", 4000))? + .bind((config.http.host, config.http.port))? .run() .await?; Ok(())