♻️ I have no idea what am I doing. Might be mixing stuff
This commit is contained in:
@@ -44,4 +44,37 @@ public static class ServiceHelper
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddDriveService(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<FileService.FileServiceClient>(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
|
||||
.CreateFileServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
});
|
||||
|
||||
services.AddSingleton<FileReferenceService.FileReferenceServiceClient>(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
|
||||
.CreateFileReferenceServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user