tangled
alpha
login
or
join now
pierrelf.com
/
grain
0
fork
atom
Rust implementation of OCI Distribution Spec with granular access control
0
fork
atom
overview
issues
9
pulls
pipelines
fix: set server status to Ready after successful bind
pierrelf.com
3 months ago
b9d3d38d
3e14f837
+10
-1
1 changed file
expand all
collapse all
unified
split
src
main.rs
+10
-1
src/main.rs
···
38
38
39
39
// Shared app state
40
40
let shared_state = Arc::new(state::new_app(&args));
41
41
+
let state_clone = shared_state.clone();
41
42
42
43
let app = Router::new()
43
44
.route("/", get(meta::index)) // Index, info
···
109
110
.route("/{*path}", put(meta::catch_all_put))
110
111
.route("/{*path}", patch(meta::catch_all_patch))
111
112
.route("/{*path}", delete(meta::catch_all_delete))
112
112
-
.with_state(shared_state)
113
113
+
.with_state(state_clone)
113
114
.layer(DefaultBodyLimit::disable()) // Allow unlimited body size for blob uploads
114
115
.layer(axum::middleware::from_fn(middleware::track_metrics))
115
116
.layer(CorsLayer::permissive())
···
120
121
121
122
log::info!("Listening on: {}", &args.host);
122
123
let listener = tokio::net::TcpListener::bind(&args.host).await.unwrap();
124
124
+
125
125
+
// Mark server as ready after successful bind
126
126
+
{
127
127
+
let mut status = shared_state.server_status.lock().await;
128
128
+
*status = state::ServerStatus::Ready;
129
129
+
log::info!("Server status: Ready");
130
130
+
}
131
131
+
123
132
axum::serve(listener, app).await.unwrap();
124
133
}