postrust_proxy/config/file.rs
1//! File-based configuration loading.
2
3use crate::config::ProxyConfig;
4use crate::error::ProxyResult;
5use std::path::Path;
6
7/// Load proxy configuration from a TOML file.
8pub async fn load_from_file(path: impl AsRef<Path>) -> ProxyResult<ProxyConfig> {
9 let content = tokio::fs::read_to_string(path).await?;
10 let config: ProxyConfig = toml::from_str(&content)?;
11 Ok(config)
12}