diff --git a/WatcherAgent/src/config.rs b/WatcherAgent/src/config.rs index c9e3893..f3fe41d 100644 --- a/WatcherAgent/src/config.rs +++ b/WatcherAgent/src/config.rs @@ -1,14 +1,6 @@ -use config::Config; -use serde::Deserialize; - use crate::models::WatcherConfig; -#[derive(Debug, Deserialize, Clone)] -pub struct AppConfig { - pub watcher: WatcherConfig, -} - -impl AppConfig { +impl WatcherConfig { pub fn from_env() -> Result { // Load .env file (works in both Docker and local development) dotenvy::dotenv().ok(); diff --git a/WatcherAgent/src/main.rs b/WatcherAgent/src/main.rs index 6a68847..eaf150e 100644 --- a/WatcherAgent/src/main.rs +++ b/WatcherAgent/src/main.rs @@ -7,7 +7,7 @@ pub mod hardware; pub mod metrics; pub mod models; -use config::AppConfig; +use models::WatcherConfig; use std::error::Error; use std::marker::Send; @@ -27,8 +27,8 @@ async fn flatten( #[tokio::main] async fn main() -> Result<(), Box> { - let config = AppConfig::from_env().expect("Failed to load configuration"); - let server_url = config.watcher.server_url.clone(); + let config = WatcherConfig::from_env().expect("Failed to load configuration"); + let server_url = config.server_url.clone(); // Registration let (server_id, ip) = match api::register_with_server(&server_url).await {