set manually bind address

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

View File

@ -18,13 +18,14 @@ rust-latest:
stage: build_backend stage: build_backend
image: rust:latest image: rust:latest
script: script:
- mkdir ./lib/webroot - cd lib
- cp -r ./app/build/web/* ./lib/webroot - mkdir ./webroot
- cargo build -r --manifest-path=lib/Cargo.toml --features static - cp -r ../app/build/web/* ./webroot
- mv ./lib/target/release/raid_manager ./lib/target/release/raid_manager_static - cargo build -r --features static
- cargo build -r --manifest-path=lib/Cargo.toml - mv ./target/release/raid_manager ./target/release/raid_manager_static
- cargo test -r --manifest-path=lib/Cargo.toml - cargo build -r
- cp ./lib/target/release/raid_manager* . - cargo test -r
- cp ./target/release/raid_manager* ..
artifacts: artifacts:
expire_in: 2 days expire_in: 2 days
paths: paths:

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