aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-server/src')
-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";