fmt: cleanup & cargo fmt
This commit is contained in:
parent
b8e1235396
commit
2c91e99a4d
@ -67,14 +67,14 @@ impl IntoResponse for ApiError {
|
||||
StatusCode::UNAUTHORIZED,
|
||||
Json(RegistrationResponse::user_interactive_authorization_info()),
|
||||
).into_response(),
|
||||
RegistrationError::InvalidUserId => (StatusCode::OK, Json(
|
||||
ErrorResponse::new(
|
||||
RegistrationError::InvalidUserId | RegistrationError::MissingUserId => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
Json(ErrorResponse::new(
|
||||
ErrorCode::InvalidUsername,
|
||||
®istration_error.to_string(),
|
||||
None,
|
||||
)
|
||||
)).into_response(),
|
||||
RegistrationError::MissingUserId => (StatusCode::OK, String::new()).into_response(),
|
||||
RegistrationError::UserIdTaken => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
Json(ErrorResponse::new(
|
||||
|
@ -1,3 +1,3 @@
|
||||
pub mod auth;
|
||||
pub mod versions;
|
||||
pub mod errors;
|
||||
pub mod versions;
|
||||
|
12
src/main.rs
12
src/main.rs
@ -35,18 +35,16 @@ impl Default for Config {
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
std::env::set_var("RUST_LOG", "debug");
|
||||
}
|
||||
|
||||
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let config = Arc::new(Config::default());
|
||||
|
||||
let pool = sqlx::SqlitePool::connect(&config.db_path)
|
||||
.await
|
||||
.unwrap();
|
||||
let pool = sqlx::SqlitePool::connect(&config.db_path).await?;
|
||||
|
||||
let cors = CorsLayer::new()
|
||||
.allow_origin(tower_http::cors::Any)
|
||||
@ -69,7 +67,9 @@ async fn main() {
|
||||
|
||||
let _ = axum::Server::bind(&"127.0.0.1:3000".parse().unwrap())
|
||||
.serve(router.into_make_service())
|
||||
.await;
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn fallback(request: Request<Body>) -> StatusCode {
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod authentication_data;
|
||||
pub mod error_code;
|
||||
pub mod flow;
|
||||
pub mod identifier;
|
||||
pub mod identifier_type;
|
||||
pub mod matrix_user_id;
|
||||
pub mod user_interactive_authorization;
|
||||
pub mod error_code;
|
Loading…
x
Reference in New Issue
Block a user