use clap::{Parser, Subcommand}; #[derive(Parser, Debug)] #[command(author, version, about = "Authorization CLI for managing policies")] struct Args { #[command(subcommand)] command: Commands, } #[derive(Subcommand, Debug)] enum Commands { Server { /// Address to bind to #[arg(short, long, env = "BIND_ADDR", default_value = "127.0.0.1:50052")] addr: String, }, } #[tokio::main] async fn main() -> Result<(), Box> { let args = Args::parse(); match args.command { Commands::Server { addr } => { tracing_subscriber::fmt() .json() .with_ansi(false) .with_current_span(true) .with_file(true) .with_level(false) .with_line_number(true) .with_max_level(tracing::Level::INFO) .with_span_list(true) .with_target(false) .with_thread_ids(false) .with_thread_names(false) .init(); tracing::info!(address = %addr, "Starting"); authzd::authorization::Server::new( authzd::authorization::spice::Authorizer::default(), )? .serve(addr.parse().unwrap()) .await?; } } Ok(()) }