From c7b748f34aed7d697c85cc0415085086787f79a8 Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Fri, 9 Dec 2022 23:18:13 +0100 Subject: [PATCH] set manually bind address --- .gitlab-ci.yml | 15 ++++++++------- lib/Rocket.toml | 3 --- lib/src/main.rs | 7 ++++++- 3 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 lib/Rocket.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a4ebef..9ecc48e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,13 +18,14 @@ rust-latest: stage: build_backend image: rust:latest script: - - mkdir ./lib/webroot - - cp -r ./app/build/web/* ./lib/webroot - - cargo build -r --manifest-path=lib/Cargo.toml --features static - - mv ./lib/target/release/raid_manager ./lib/target/release/raid_manager_static - - cargo build -r --manifest-path=lib/Cargo.toml - - cargo test -r --manifest-path=lib/Cargo.toml - - cp ./lib/target/release/raid_manager* . + - cd lib + - mkdir ./webroot + - cp -r ../app/build/web/* ./webroot + - cargo build -r --features static + - mv ./target/release/raid_manager ./target/release/raid_manager_static + - cargo build -r + - cargo test -r + - cp ./target/release/raid_manager* .. artifacts: expire_in: 2 days paths: diff --git a/lib/Rocket.toml b/lib/Rocket.toml deleted file mode 100644 index d159607..0000000 --- a/lib/Rocket.toml +++ /dev/null @@ -1,3 +0,0 @@ -## defaults for _all_ profiles -[default] -address = "0.0.0.0" \ No newline at end of file diff --git a/lib/src/main.rs b/lib/src/main.rs index 64e0883..65a6d60 100644 --- a/lib/src/main.rs +++ b/lib/src/main.rs @@ -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> { 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{});