use std::thread;
use std::time::Duration;
use detrix_rs::{self as detrix, Config};
fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter("detrix=debug")
.init();
println!("Initializing Detrix client...");
detrix::init(Config {
name: Some("basic-example".to_string()),
..Config::default()
})?;
let status = detrix::status();
println!("\nDetrix client initialized:");
println!(" State: {}", status.state);
println!(
" Control plane: http://{}:{}",
status.control_host, status.control_port
);
println!(" Daemon URL: {}", status.daemon_url);
println!("\nTo wake the client, run:");
println!(
" curl -X POST http://127.0.0.1:{}/detrix/wake",
status.control_port
);
println!("\nRunning forever... Press Ctrl+C to stop.");
let mut counter = 0;
loop {
counter += 1;
println!("Iteration {}", counter);
thread::sleep(Duration::from_secs(3));
}
}