set manually bind address

This commit is contained in:
2022-12-09 23:18:13 +01:00
parent f60033e02c
commit c7b748f34a
3 changed files with 14 additions and 11 deletions

View File

@ -1,3 +0,0 @@
## defaults for _all_ profiles
[default]
address = "0.0.0.0"

View File

@ -7,6 +7,7 @@ mod embed;
use rocket::error::ErrorKind;
use rocket::serde::json::Json;
use rocket::config::{Config};
#[cfg(feature = "static")]
use crate::embed::CustomHandler;
use crate::parser::lsblk_parser::{Disk, parse_lsblk};
@ -26,7 +27,11 @@ fn get_disks() -> Json<Vec<Disk>> {
async fn main() -> Result<(), rocket::Error> {
println!("init server");
println!("access at: http://127.0.0.1:8000/");
let b = rocket::build();
let mut cfg = Config::default();
cfg.address = "0.0.0.0".parse().unwrap();
let b = rocket::custom(cfg);
let b = b.mount("/api", routes![get_raid_devices, get_disks]);
#[cfg(feature = "static")]
let b = b.mount("/", CustomHandler{});