-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
23 lines (22 loc) · 952 Bytes
/
Copy pathmain.rs
File metadata and controls
23 lines (22 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use execution_engine::extension_api;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = dotenvy::dotenv();
// Build the router first so we fail fast with a helpful message if
// the data root is unwritable or the auth tokens file is corrupt.
// `try_router` returns `Err(String)` instead of panicking in
// `AppState::new`, which previously aborted the process without a
// clear way for operators to diagnose.
let router = match extension_api::try_router() {
Ok(router) => router,
Err(error) => {
eprintln!("execution-engine startup failed: {error}");
return Err(error.into());
}
};
let bind_address = extension_api::host_bind_address();
let listener = tokio::net::TcpListener::bind(&bind_address).await?;
println!("execution-engine listening on http://{bind_address}");
axum::serve(listener, router).await?;
Ok(())
}