From bbed87755419f97b0ee8967617af0c6573c168af Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 4 Jul 2022 20:11:29 +0200 Subject: cleanup and comments --- planetwars-server/src/modules/registry.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/planetwars-server/src/modules/registry.rs b/planetwars-server/src/modules/registry.rs index d73e7e9..c8ec4fa 100644 --- a/planetwars-server/src/modules/registry.rs +++ b/planetwars-server/src/modules/registry.rs @@ -1,6 +1,7 @@ +// TODO: this module is functional, but it needs a good refactor for proper error handling. + use axum::body::{Body, StreamBody}; use axum::extract::{BodyStream, FromRequest, Path, Query, RequestParts, TypedHeader}; -use axum::handler::Handler; use axum::headers::authorization::Basic; use axum::headers::Authorization; use axum::response::{IntoResponse, Response}; @@ -19,13 +20,13 @@ use crate::{db, DatabaseConnection}; use crate::db::users::{authenticate_user, Credentials, User}; +// TODO: put this in a config file const REGISTRY_PATH: &str = "./data/registry"; pub fn registry_service() -> Router { Router::new() // The docker API requires this trailing slash .nest("/v2/", registry_api_v2()) - .fallback(fallback.into_service()) } fn registry_api_v2() -> Router { @@ -46,12 +47,6 @@ fn registry_api_v2() -> Router { ) } -async fn fallback(request: axum::http::Request) -> impl IntoResponse { - // for debugging - println!("no route for {} {}", request.method(), request.uri()); - StatusCode::NOT_FOUND -} - const ADMIN_USERNAME: &str = "admin"; // TODO: put this in some configuration const ADMIN_PASSWORD: &str = "supersecretpassword"; -- cgit v1.2.3