♻️ Updated discovery resolver
This commit is contained in:
@@ -7,11 +7,10 @@ namespace DysonNetwork.Shared.Registry;
|
||||
|
||||
public static class ServiceInjectionHelper
|
||||
{
|
||||
public static IServiceCollection AddRingService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddRingService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("ring", "grpc").GetAwaiter().GetResult();
|
||||
services
|
||||
.AddGrpcClient<RingService.RingServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<RingService.RingServiceClient>(o => o.Address = new Uri("https://ring"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -19,17 +18,16 @@ public static class ServiceInjectionHelper
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAuthService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddAuthService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("pass", "grpc").GetAwaiter().GetResult();
|
||||
services
|
||||
.AddGrpcClient<AuthService.AuthServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<AuthService.AuthServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services
|
||||
.AddGrpcClient<PermissionService.PermissionServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<PermissionService.PermissionServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -37,11 +35,10 @@ public static class ServiceInjectionHelper
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAccountService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddAccountService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("pass", "grpc").GetAwaiter().GetResult();
|
||||
services
|
||||
.AddGrpcClient<AccountService.AccountServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<AccountService.AccountServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -49,42 +46,42 @@ public static class ServiceInjectionHelper
|
||||
|
||||
services
|
||||
.AddGrpcClient<BotAccountReceiverService.BotAccountReceiverServiceClient>(o =>
|
||||
o.Address = new Uri(instance)
|
||||
o.Address = new Uri("https://pass")
|
||||
)
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services.AddGrpcClient<ActionLogService.ActionLogServiceClient>(o => o.Address = new Uri(instance))
|
||||
services.AddGrpcClient<ActionLogService.ActionLogServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services.AddGrpcClient<PaymentService.PaymentServiceClient>(o => o.Address = new Uri(instance))
|
||||
services.AddGrpcClient<PaymentService.PaymentServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services.AddGrpcClient<WalletService.WalletServiceClient>(o => o.Address = new Uri(instance))
|
||||
services.AddGrpcClient<WalletService.WalletServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services
|
||||
.AddGrpcClient<RealmService.RealmServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<RealmService.RealmServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
services.AddSingleton<RemoteRealmService>();
|
||||
|
||||
|
||||
services
|
||||
.AddGrpcClient<SocialCreditService.SocialCreditServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<SocialCreditService.SocialCreditServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
|
||||
services
|
||||
.AddGrpcClient<ExperienceService.ExperienceServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<ExperienceService.ExperienceServiceClient>(o => o.Address = new Uri("https://pass"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -92,16 +89,15 @@ public static class ServiceInjectionHelper
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddDriveService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddDriveService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("drive", "grpc").GetAwaiter().GetResult();
|
||||
services.AddGrpcClient<FileService.FileServiceClient>(o => o.Address = new Uri(instance))
|
||||
services.AddGrpcClient<FileService.FileServiceClient>(o => o.Address = new Uri("https://drive"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services.AddGrpcClient<FileReferenceService.FileReferenceServiceClient>(o =>
|
||||
o.Address = new Uri("https://_grpc.drive"))
|
||||
o.Address = new Uri("https://drive"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -109,17 +105,16 @@ public static class ServiceInjectionHelper
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddSphereService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddSphereService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("drive", "grpc").GetAwaiter().GetResult();
|
||||
services
|
||||
.AddGrpcClient<PostService.PostServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<PostService.PostServiceClient>(o => o.Address = new Uri("https://sphere"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
services
|
||||
.AddGrpcClient<PublisherService.PublisherServiceClient>(o => o.Address = new Uri(instance))
|
||||
.AddGrpcClient<PublisherService.PublisherServiceClient>(o => o.Address = new Uri("https://sphere"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
@@ -127,15 +122,14 @@ public static class ServiceInjectionHelper
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddDevelopService(this IServiceCollection services, ServiceRegistrar registrar)
|
||||
public static IServiceCollection AddDevelopService(this IServiceCollection services)
|
||||
{
|
||||
var instance = registrar.GetServiceInstanceAsync("develop", "grpc").GetAwaiter().GetResult();
|
||||
services.AddGrpcClient<CustomAppService.CustomAppServiceClient>(o =>
|
||||
o.Address = new Uri(instance))
|
||||
o.Address = new Uri("https://develop"))
|
||||
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
|
||||
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
|
||||
);
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user