diff --git a/config.toml b/config.toml index e1064a4..e6c1b74 100644 --- a/config.toml +++ b/config.toml @@ -1,5 +1,6 @@ [http] -host = "0.0.0.0:8080" +host = "0.0.0.0" +port = 8080 cors = [ "127.0.0.1:8000", "localhost:8000", diff --git a/core/src/main.rs b/core/src/main.rs index 92a2e61..f823c00 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -20,7 +20,13 @@ async fn main() { .map(|e| e.parse().expect("parse CORS host")) .collect(); - homedisk_server::serve(config.http.host.clone(), origins, db, config) + let host = format!( + "{host}:{port}", + host = config.http.host, + port = config.http.port + ); + + homedisk_server::serve(host, origins, db, config) .await .expect("start http server"); } diff --git a/utils/src/config/parser.rs b/utils/src/config/parser.rs index 2d705d9..9d6e7b4 100644 --- a/utils/src/config/parser.rs +++ b/utils/src/config/parser.rs @@ -13,6 +13,7 @@ pub struct Config { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigHTTP { pub host: String, + pub port: u16, pub cors: Vec, }