tsk-61: code formatting
Some checks failed
Rust Build / Check (pull_request) Successful in 40s
Rust Build / Test Suite (pull_request) Failing after 1m25s
Rust Build / Rustfmt (pull_request) Successful in 30s
Rust Build / Clippy (pull_request) Successful in 39s
Rust Build / build (pull_request) Successful in 58s
Some checks failed
Rust Build / Check (pull_request) Successful in 40s
Rust Build / Test Suite (pull_request) Failing after 1m25s
Rust Build / Rustfmt (pull_request) Successful in 30s
Rust Build / Clippy (pull_request) Successful in 39s
Rust Build / build (pull_request) Successful in 58s
This commit is contained in:
@@ -53,15 +53,16 @@ pub async fn register_user(
|
|||||||
Json(payload): Json<request::Request>,
|
Json(payload): Json<request::Request>,
|
||||||
) -> (StatusCode, Json<response::Response>) {
|
) -> (StatusCode, Json<response::Response>) {
|
||||||
let registration_enabled = match is_registration_enabled().await {
|
let registration_enabled = match is_registration_enabled().await {
|
||||||
Ok(value) => {
|
Ok(value) => value,
|
||||||
value
|
|
||||||
}
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("Error: {err:?}");
|
eprintln!("Error: {err:?}");
|
||||||
return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, Json(response::Response{
|
return (
|
||||||
message: String::from("Registration check failed"),
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
data: Vec::new()
|
Json(response::Response {
|
||||||
}));
|
message: String::from("Registration check failed"),
|
||||||
|
data: Vec::new(),
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -130,10 +131,13 @@ pub async fn register_user(
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(axum::http::StatusCode::NOT_ACCEPTABLE, Json(response::Response{
|
(
|
||||||
message: String::from("Registration is not enabled"),
|
axum::http::StatusCode::NOT_ACCEPTABLE,
|
||||||
data: Vec::new()
|
Json(response::Response {
|
||||||
}))
|
message: String::from("Registration is not enabled"),
|
||||||
|
data: Vec::new(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +152,8 @@ async fn is_registration_enabled() -> Result<bool, std::io::Error> {
|
|||||||
} else if parsed_value == "FALSE" {
|
} else if parsed_value == "FALSE" {
|
||||||
Ok(false)
|
Ok(false)
|
||||||
} else {
|
} else {
|
||||||
Err(std::io::Error::other("Could not determine value of ENABLE_REGISTRATION"))
|
Err(std::io::Error::other(
|
||||||
|
"Could not determine value of ENABLE_REGISTRATION",
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user