37 lines
994 B
Rust
37 lines
994 B
Rust
//! NxMesh Agent - Data Plane
|
|
//!
|
|
//! The agent is a lightweight sidecar that manages local nginx instances
|
|
//! and communicates with the master control plane.
|
|
|
|
use tracing::{info, error};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Initialize tracing
|
|
tracing_subscriber::fmt()
|
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
|
.init();
|
|
|
|
info!("Starting NxMesh Agent v{}", env!("CARGO_PKG_VERSION"));
|
|
|
|
// Load configuration
|
|
let config = match nxmesh_agent::config::Settings::load() {
|
|
Ok(cfg) => cfg,
|
|
Err(e) => {
|
|
error!("Failed to load configuration: {}", e);
|
|
std::process::exit(1);
|
|
}
|
|
};
|
|
|
|
info!("Configuration loaded successfully");
|
|
info!("Master URL: {}", config.master.url);
|
|
|
|
// Start the agent
|
|
if let Err(e) = nxmesh_agent::start(config).await {
|
|
error!("Agent error: {}", e);
|
|
std::process::exit(1);
|
|
}
|
|
|
|
Ok(())
|
|
}
|