cli_config_reciever fn added

feature/configv2
prplV 2025-02-04 16:53:29 +03:00
parent df03bd5346
commit 7a5704dd93
1 changed files with 19 additions and 7 deletions

View File

@ -15,10 +15,13 @@ use tokio::sync::oneshot::Receiver;
// const CONFIG_PATH: &str = "settings.json"; // const CONFIG_PATH: &str = "settings.json";
pub mod v2 { pub mod v2 {
use std::ops::Deref;
use super::*; use super::*;
pub async fn init_config_mechanism(cli_oneshot: Arc<Receiver<Processes>> /*...*/) { /* local + pubsub + cli oneshot check */ } pub async fn init_config_mechanism(cli_oneshot: Arc<Receiver<Processes>> /*...*/) {
pub async fn get_pubsub<'a>(params: Arc<PrebootParams>) -> Option<PubSub<'a>> { /* local + pubsub + cli oneshot check */
// let config_path = params.config.to_str().unwrap_or_else(|| "settings.json"); }
pub async fn get_redis_connection(params: Arc<PrebootParams>) -> Option<Connection> {
if params.no_sub { if params.no_sub {
return None; return None;
} }
@ -51,9 +54,18 @@ pub mod v2 {
None None
} }
pub async fn get_local_config_watcher(/*...*/) { /*...*/ } pub async fn get_local_config_watcher(params: Arc<PrebootParams> /*...*/) {
// /*...*/
pub async fn cli_config_reciever(cli_oneshot: Arc<Receiver<Processes>>) { /*...*/ } }
// [:IN-TEST]
pub async fn cli_config_reciever(cli_oneshot: Receiver<Processes>) -> Option<Processes> {
/* match awaits til channel*/
match cli_oneshot.await {
Ok(config_from_cli) => return Some(config_from_cli),
_ => None,
}
}
} }