added .env readability
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
/// This agent collects hardware metrics and sends them to a backend server.
|
||||
/// It supports CPU, GPU, RAM, disk, and network metrics.
|
||||
pub mod api;
|
||||
pub mod config;
|
||||
pub mod hardware;
|
||||
pub mod metrics;
|
||||
pub mod models;
|
||||
|
||||
pub use crate::hardware::gpu;
|
||||
use config::AppConfig;
|
||||
|
||||
use std::error::Error;
|
||||
use std::marker::Send;
|
||||
use std::marker::Sync;
|
||||
@@ -25,10 +27,11 @@ async fn flatten<T>(
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
let server_url = "http://localhost:5000";
|
||||
let config = AppConfig::from_env().expect("Failed to load configuration");
|
||||
let server_url = config.watcher.server_url.clone();
|
||||
|
||||
// Registration
|
||||
let (server_id, ip) = match api::register_with_server(server_url).await {
|
||||
let (server_id, ip) = match api::register_with_server(&server_url).await {
|
||||
Ok((id, ip)) => (id, ip),
|
||||
Err(e) => {
|
||||
eprintln!("Fehler bei der Registrierung am Server: {e}");
|
||||
|
Reference in New Issue
Block a user