diff --git a/noxis-rs/src/main.rs b/noxis-rs/src/main.rs index 7a1ca45..68a179d 100644 --- a/noxis-rs/src/main.rs +++ b/noxis-rs/src/main.rs @@ -29,6 +29,8 @@ async fn main() -> anyhow::Result<()>{ info!("Noxis is configurating..."); // let (tx_brd, mut rx_brd) = broadcast::channel::(1); + // for cli to get config + let mut rx_cli_brd = tx_brd.subscribe(); // cli <-> config let (tx_oneshot, rx_oneshot) = oneshot::channel::(); let mut handler: Vec> = vec![]; @@ -47,7 +49,17 @@ async fn main() -> anyhow::Result<()>{ // initilaizing task for cli manipulation let preboot_cli = preboot.clone(); let cli_module = tokio::spawn(async move { - if let Err(er) = init_cli_pipeline(preboot_cli).await { + let config = { + let mut tick = tokio::time::interval(Duration::from_millis(500)); + loop { + tick.tick().await; + break match rx_cli_brd.try_recv() { + Ok(conf) => conf, + Err(_) => continue, + } + } + }; + if let Err(er) = init_cli_pipeline(preboot_cli, Arc::new(config)).await { error!("CLI pipeline failed due to {}", er) } });