refactor: move business logic into app

* also move all at directory root crate

* all actors are into lib directory

* formatter is into system_monitor now
This commit is contained in:
2025-08-09 13:52:38 +02:00
parent 3bb8f39e34
commit 985ee54669
15 changed files with 67 additions and 68 deletions

25
src/main.rs Normal file
View File

@@ -0,0 +1,25 @@
use discord_client::DiscordNotifier;
use dotenvy::dotenv;
use system_monitor::SystemMonitor;
mod app {
pub mod service;
}
fn main() {
dotenv().ok();
let notifier = DiscordNotifier::new(
std::env::var("DISCORD_WEBHOOK").expect("DISCORD_WEBHOOK environment variable not set"),
"System Monitor".to_string(),
"https://cdn.shopify.com/s/files/1/0262/1423/6212/files/Lord_of_the_Rings_eye_of_Sauron_-_Ghtic.com_-_Blog.png?v=1579680018".to_string(),
);
let monitor =
SystemMonitor::new(system_monitor::resource_threshold::get_default_resource_thresholds());
let formatter = system_monitor::alert_formatter::AlertFormatter;
let service = app::service::new(notifier, monitor, formatter);
service.run();
}