From 7a5704dd93e23c7126209d1c233f06ab1e4cb0f8 Mon Sep 17 00:00:00 2001 From: prplV Date: Tue, 4 Feb 2025 16:53:29 +0300 Subject: [PATCH] cli_config_reciever fn added --- noxis-rs/src/options/config.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/noxis-rs/src/options/config.rs b/noxis-rs/src/options/config.rs index cabab29..35ed603 100644 --- a/noxis-rs/src/options/config.rs +++ b/noxis-rs/src/options/config.rs @@ -15,10 +15,13 @@ use tokio::sync::oneshot::Receiver; // const CONFIG_PATH: &str = "settings.json"; pub mod v2 { + use std::ops::Deref; + use super::*; - pub async fn init_config_mechanism(cli_oneshot: Arc> /*...*/) { /* local + pubsub + cli oneshot check */ } - pub async fn get_pubsub<'a>(params: Arc) -> Option> { - // let config_path = params.config.to_str().unwrap_or_else(|| "settings.json"); + pub async fn init_config_mechanism(cli_oneshot: Arc> /*...*/) { + /* local + pubsub + cli oneshot check */ + } + pub async fn get_redis_connection(params: Arc) -> Option { if params.no_sub { return None; } @@ -31,7 +34,7 @@ pub mod v2 { // let channel_name = channel_name.trim(); let mut pubsub = conn.as_pubsub(); if pubsub.subscribe(&channel_name.trim()).is_ok() { - + todo!() } else { @@ -51,9 +54,18 @@ pub mod v2 { None } - pub async fn get_local_config_watcher(/*...*/) { /*...*/ } - // - pub async fn cli_config_reciever(cli_oneshot: Arc>) { /*...*/ } + pub async fn get_local_config_watcher(params: Arc /*...*/) { + /*...*/ + } + + // [:IN-TEST] + pub async fn cli_config_reciever(cli_oneshot: Receiver) -> Option { + /* match awaits til channel*/ + match cli_oneshot.await { + Ok(config_from_cli) => return Some(config_from_cli), + _ => None, + } + } }