rush_sync_server/core/helpers.rs
1use crate::core::prelude::*;
2
3/// Runtime-sicherer Config-Loader
4pub fn get_config() -> Result<Config> {
5 // Einfachste Lösung: Channel-basiert
6 let (tx, rx) = std::sync::mpsc::channel();
7
8 std::thread::spawn(move || {
9 let rt = tokio::runtime::Runtime::new().unwrap();
10 let result = rt.block_on(Config::load());
11 let _ = tx.send(result);
12 });
13
14 rx.recv()
15 .map_err(|_| AppError::Validation("Config loading timeout".to_string()))?
16}