aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-04 20:11:29 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-04 20:11:29 +0200
commitbbed87755419f97b0ee8967617af0c6573c168af (patch)
treeeda552f82fc4151e49d44abf4a8c7f56811a0e75
parent7b88bb0502f67e913b6e8bca394428fd2df45cc2 (diff)
downloadplanetwars.dev-bbed87755419f97b0ee8967617af0c6573c168af.tar.xz
planetwars.dev-bbed87755419f97b0ee8967617af0c6573c168af.zip
cleanup and comments
-rw-r--r--planetwars-server/src/modules/registry.rs11
1 files 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<Body>) -> 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";