summaryrefslogtreecommitdiff
path: root/src/bin/cli.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-11 13:59:08 -0600
committermo khan <mo@mokhan.ca>2025-07-11 13:59:08 -0600
commit7eab1fc010c04c76f60a8dd4d8a72572ddd2785a (patch)
treeaf95f171952b7ce557904bd925932365542bc22f /src/bin/cli.rs
parentef572ae666732e87a35417710669ce88233a754a (diff)
parente7015c080181eba17296d0dc678b0e5578fadc15 (diff)
Merge branch 'cli' into 'main'
Merge server and cli binaries into one See merge request gitlab-org/software-supply-chain-security/authorization/authzd!8
Diffstat (limited to 'src/bin/cli.rs')
-rw-r--r--src/bin/cli.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bin/cli.rs b/src/bin/cli.rs
index fc70ae82..6f089353 100644
--- a/src/bin/cli.rs
+++ b/src/bin/cli.rs
@@ -38,6 +38,11 @@ enum Commands {
)]
host: String,
},
+ Server {
+ /// Address to bind to
+ #[arg(short, long, env = "BIND_ADDR", default_value = "127.0.0.1:50051")]
+ addr: String,
+ },
}
#[tokio::main]
@@ -63,6 +68,24 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
output
);
}
+ Commands::Server { addr } => {
+ tracing_subscriber::fmt()
+ .json()
+ .with_max_level(tracing::Level::INFO)
+ .with_current_span(true)
+ .with_span_list(true)
+ .with_target(true)
+ .with_thread_ids(true)
+ .with_thread_names(true)
+ .with_file(true)
+ .with_line_number(true)
+ .init();
+
+ tracing::info!(address = %addr, "Starting authorization server");
+ authzd::authorization::Server::new(authzd::authorization::CedarAuthorizer::default())?
+ .serve(addr.parse().unwrap())
+ .await?;
+ }
}
Ok(())