Files
supervisor/examples/test_register_runner.rs
Timur Gordon 767c66fb6a initial commit
2025-08-26 14:49:21 +02:00

47 lines
1.5 KiB
Rust

//! Test program for register_runner functionality with secret authentication
use hero_supervisor::{SupervisorApp};
use log::info;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
info!("Starting supervisor with test secrets...");
// Create supervisor app with test secrets
let mut app = SupervisorApp::builder()
.redis_url("redis://localhost:6379")
.db_path("/tmp/hero_test_db")
.queue_key("hero:test_queue")
.admin_secret("admin123")
.register_secret("register456")
.user_secret("user789")
.build()
.await?;
info!("Supervisor configured with secrets:");
info!(" Admin secrets: {:?}", app.supervisor.admin_secrets());
info!(" Register secrets: {:?}", app.supervisor.register_secrets());
info!(" User secrets: {:?}", app.supervisor.user_secrets());
// Start OpenRPC server
let supervisor_arc = std::sync::Arc::new(tokio::sync::Mutex::new(app.supervisor.clone()));
info!("Starting OpenRPC server...");
hero_supervisor::openrpc::start_openrpc_servers(supervisor_arc).await?;
info!("Supervisor is running with OpenRPC server on http://127.0.0.1:3030");
info!("Test secrets configured:");
info!(" Admin secret: admin123");
info!(" Register secret: register456");
info!(" User secret: user789");
info!("Press Ctrl+C to stop...");
// Keep running
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
}
}