Files
watcheragent/WatcherAgent/src/config.rs
2025-08-28 18:25:19 +02:00

15 lines
415 B
Rust

use crate::models::WatcherConfig;
impl WatcherConfig {
pub fn from_env() -> Result<Self, config::ConfigError> {
// Load .env file (works in both Docker and local development)
dotenvy::dotenv().ok();
let mut cfg = config::Config::builder()
.add_source(config::Environment::with_prefix("WATCHER").separator("_"))
.build()?;
cfg.try_deserialize()
}
}