Skip to content

Commit

Permalink
minors
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Jul 1, 2024
1 parent 73fb55a commit 6434379
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,31 @@ impl ApplicationServer {
.route("/faucet", get(faucet_handler::request_challenge))
.route("/faucet", post(faucet_handler::request_transfer))
.with_state(faucet_state)
.merge(Router::new().route(
"/health",
get(|| async { env!("VERGEN_GIT_SHA").to_string() }),
))
};

let cors = CorsLayer::new()
.allow_origin("*".parse::<HeaderValue>().unwrap())
.allow_methods(Any)
.allow_headers(Any);

let router = Router::new().nest("/api/v1", routes).layer(
ServiceBuilder::new()
.layer(TraceLayer::new_for_http())
.layer(HandleErrorLayer::new(Self::handle_timeout_error))
.timeout(Duration::from_secs(*HTTP_TIMEOUT))
.layer(cors)
.layer(BufferLayer::new(4096))
.layer(RateLimitLayer::new(
rps.unwrap_or(*REQ_PER_SEC),
Duration::from_secs(1),
)),
);
let router = Router::new()
.nest("/api/v1", routes)
.merge(Router::new().route(
"/health",
get(|| async { env!("VERGEN_GIT_SHA").to_string() }),
))
.layer(
ServiceBuilder::new()
.layer(TraceLayer::new_for_http())
.layer(HandleErrorLayer::new(Self::handle_timeout_error))
.timeout(Duration::from_secs(*HTTP_TIMEOUT))
.layer(cors)
.layer(BufferLayer::new(4096))
.layer(RateLimitLayer::new(
rps.unwrap_or(*REQ_PER_SEC),
Duration::from_secs(1),
)),
);

let router = router.fallback(Self::handle_404);

Expand Down

0 comments on commit 6434379

Please sign in to comment.