♻️ Extract the Developer to new service, add PublisherServiceGrpc

This commit is contained in:
2025-08-07 17:16:38 +08:00
parent f1ea7c1c5a
commit 00cdd1bc5d
35 changed files with 602 additions and 101 deletions

View File

@@ -92,4 +92,23 @@ public static class ServiceInjectionHelper
return services;
}
public static IServiceCollection AddPublisherService(this IServiceCollection services)
{
services.AddSingleton<PublisherService.PublisherServiceClient>(sp =>
{
var etcdClient = sp.GetRequiredService<IEtcdClient>();
var config = sp.GetRequiredService<IConfiguration>();
var clientCertPath = config["Service:ClientCert"]!;
var clientKeyPath = config["Service:ClientKey"]!;
var clientCertPassword = config["Service:CertPassword"];
return GrpcClientHelper
.CreatePublisherServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
.GetAwaiter()
.GetResult();
});
return services;
}
}