+
+ 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(*SYNCHRONOUS_FEDERATION)
+ .http_signature_compat(true)
+ .url_verifier(Box::new(VerifyUrlData(context.inner_pool().clone())))
+ .build()
+ .await?;
+
+ // this must come before the HttpServer creation
+ // creates a middleware that populates http metrics for each path, method, and status code
+ #[cfg(feature = "prometheus-metrics")]
+ let prom_api_metrics = PrometheusMetricsBuilder::new("lemmy_api")
+ .registry(default_registry().clone())
+ .build()
+ .expect("Should always be buildable");
+
+ MATCH_OUTGOING_ACTIVITIES
+ .set(Box::new(move |d, c| {
+ Box::pin(match_outgoing_activities(d, c))
+ }))
+ .expect("set function pointer");
+ let request_data = federation_config.to_request_data();
+ let outgoing_activities_task = tokio::task::spawn(handle_outgoing_activities(request_data));
+
+ // Create Http server with websocket support