summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 511d3d0440c82e90a52d9bc376bccad06f9b8c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    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();

    let addr = std::env::var("BIND_ADDR")
        .unwrap_or_else(|_| "127.0.0.1:50051".to_string())
        .parse()?;

    tracing::info!(address = %addr, "Starting authorization server");
    let server = authzd::authorization::Server::new()?;
    server.serve(addr).await?;

    Ok(())
}