config: separate option for port setting
This commit is contained in:
parent
ac2eff6399
commit
b5ee35dfe8
|
@ -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",
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ pub struct Config {
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ConfigHTTP {
|
||||
pub host: String,
|
||||
pub port: u16,
|
||||
pub cors: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue