added args for running binary

This commit is contained in:
Patrick Mahnke-Hartmann
2025-09-01 13:13:27 +02:00
parent a2b80bd249
commit 2030f1f04f
3 changed files with 4 additions and 56 deletions

View File

@@ -2,13 +2,11 @@
/// 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;
use crate::config::Settings;
use std::env;
use std::error::Error;
use std::marker::Send;
use std::marker::Sync;
@@ -27,11 +25,9 @@ async fn flatten<T>(
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let settings = Settings::new().expect("Failed to load configuration");
let args: Vec<String> = env::args().collect();
// Explicit variables for each .env / config field
let _app_port = settings.app.port;
let server_url = settings.server.url;
let server_url = &args[1];
// Registration
let (server_id, ip) = match api::register_with_server(&server_url).await {