restflow_core/services/
config.rs1use crate::{AppCore, storage::config::SystemConfig};
2use anyhow::{Context, Result};
3use std::sync::Arc;
4
5pub async fn get_config(core: &Arc<AppCore>) -> Result<SystemConfig> {
7 match core
8 .storage
9 .config
10 .get_config()
11 .context("Failed to get config")?
12 {
13 Some(config) => Ok(config),
14 None => Ok(SystemConfig::default()),
15 }
16}
17
18pub async fn update_config(core: &Arc<AppCore>, config: SystemConfig) -> Result<()> {
20 config.validate().context("Invalid configuration")?;
22
23 core.storage
25 .config
26 .update_config(config)
27 .context("Failed to update config")
28}