});
}
- // Create Http server with websocket support
let settings_bind = settings.clone();
- HttpServer::new(move || {
- let context = context.clone();
- let federation_config = FederationConfig::builder()
- .domain(settings.hostname.clone())
- .app_data(context.clone())
- .client(client.clone())
- .http_fetch_limit(FEDERATION_HTTP_FETCH_LIMIT)
- .worker_count(local_site.federation_worker_count as u64)
- .debug(cfg!(debug_assertions))
- .http_signature_compat(true)
- .url_verifier(Box::new(VerifyUrlData(context.pool().clone())))
- .build()
- .expect("configure federation");
+ let federation_config = FederationConfig::builder()
+ .domain(settings.hostname.clone())
+ .app_data(context.clone())
+ .client(client.clone())
+ .http_fetch_limit(FEDERATION_HTTP_FETCH_LIMIT)
+ .worker_count(settings.worker_count)
+ .retry_count(settings.retry_count)
+ .debug(cfg!(debug_assertions))
+ .http_signature_compat(true)
+ .url_verifier(Box::new(VerifyUrlData(context.pool().clone())))
+ .build()
+ .await?;
+
+ // Create Http server with websocket support
+ HttpServer::new(move || {
let cors_config = if cfg!(debug_assertions) {
Cors::permissive()
} else {
};
App::new()
- .wrap(middleware::Logger::default())
+ .wrap(middleware::Logger::new(
+ // This is the default log format save for the usage of %{r}a over %a to guarantee to record the client's (forwarded) IP and not the last peer address, since the latter is frequently just a reverse proxy
+ "%{r}a '%r' %s %b '%{Referer}i' '%{User-Agent}i' %T",
+ ))
.wrap(cors_config)
.wrap(TracingLogger::<QuieterRootSpanBuilder>::new())
- .app_data(Data::new(context))
+ .app_data(Data::new(context.clone()))
.app_data(Data::new(rate_limit_cell.clone()))
- .wrap(FederationMiddleware::new(federation_config))
+ .wrap(FederationMiddleware::new(federation_config.clone()))
// The routes
.configure(|cfg| api_routes_http::config(cfg, rate_limit_cell))
.configure(|cfg| {