set manually bind address
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
## defaults for _all_ profiles
|
||||
[default]
|
||||
address = "0.0.0.0"
|
@ -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{});
|
||||
|
Reference in New Issue
Block a user