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:
25
src/main.rs
Normal file
25
src/main.rs
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user