@@ -191,8 +191,7 @@ async fn main() {
191191 . route ( "/api/auth/login" , post ( handlers:: auth:: login) )
192192 . route ( "/api/auth/logout" , post ( handlers:: auth:: logout) )
193193 . layer ( RequestBodyLimitLayer :: new ( LOGIN_BODY_LIMIT ) )
194- . layer ( GovernorLayer :: new ( rate_limit_config) )
195- . with_state ( pool. clone ( ) ) ;
194+ . layer ( GovernorLayer :: new ( rate_limit_config) ) ;
196195
197196 let admin_rate_limit_config = std:: sync:: Arc :: new (
198197 GovernorConfigBuilder :: default ( )
@@ -248,8 +247,7 @@ async fn main() {
248247 . route_layer ( axum:: middleware:: from_fn_with_state ( pool. clone ( ) , csrf:: enforce_csrf) )
249248 . route_layer ( axum:: middleware:: from_fn_with_state ( pool. clone ( ) , middleware:: auth:: auth_middleware) )
250249 . layer ( RequestBodyLimitLayer :: new ( ADMIN_BODY_LIMIT ) )
251- . layer ( GovernorLayer :: new ( admin_rate_limit_config. clone ( ) ) )
252- . with_state ( pool. clone ( ) ) ;
250+ . layer ( GovernorLayer :: new ( admin_rate_limit_config. clone ( ) ) ) ;
253251
254252 let api_routes = Router :: new ( )
255253 . route ( "/api/auth/me" , get ( handlers:: auth:: me) )
@@ -301,8 +299,7 @@ async fn main() {
301299 "/api/public/published-pages" ,
302300 get ( handlers:: site_pages:: list_published_page_slugs) ,
303301 )
304- . nest_service ( "/uploads" , ServeDir :: new ( upload_dir) )
305- . with_state ( pool. clone ( ) ) ;
302+ . nest_service ( "/uploads" , ServeDir :: new ( upload_dir) ) ;
306303
307304 // Define the application router with all routes and middleware
308305 let app = Router :: new ( )
@@ -315,7 +312,8 @@ async fn main() {
315312 . route ( "/{*path}" , get ( handlers:: frontend_proxy:: serve_index) )
316313 . layer ( axum:: middleware:: from_fn ( security:: security_headers) )
317314 . layer ( cors_layer)
318- . layer ( DefaultBodyLimit :: max ( 10 * 1024 * 1024 ) ) ; // 10MB body limit
315+ . layer ( DefaultBodyLimit :: max ( 10 * 1024 * 1024 ) ) // 10MB body limit
316+ . with_state ( pool. clone ( ) ) ;
319317
320318 // Apply trusted proxy middleware if configured
321319 let app = if trust_proxy_ip_headers {
0 commit comments