mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-04-14 23:23:25 +00:00
37 lines
922 B
Rust
37 lines
922 B
Rust
mod config;
|
|
mod server;
|
|
mod state;
|
|
mod sync;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use clap::Parser;
|
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
|
|
|
use crate::{config::QueueConfig, state::QueueState, sync::SyncService};
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[command(name = "queue-node")]
|
|
struct Args {
|
|
#[arg(short, long)]
|
|
config: PathBuf,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
tracing_subscriber::registry()
|
|
.with(
|
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| "queue_node=info,tower_http=debug".into()),
|
|
)
|
|
.with(tracing_subscriber::fmt::layer())
|
|
.init();
|
|
|
|
let args = Args::parse();
|
|
let config = QueueConfig::load(&args.config)?;
|
|
|
|
let state = QueueState::new(config.node_id);
|
|
SyncService::new(config.clone(), state.clone()).start();
|
|
server::start_server(config, state).await
|
|
}
|