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
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:

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{});