fix services

This commit is contained in:
Stanley Dimant
2022-09-13 12:01:27 +02:00
parent db3784e795
commit 3cdaa53a65
2 changed files with 6 additions and 7 deletions

View File

@@ -108,9 +108,6 @@ namespace MareSynchronosServer
options.EnableThreadSafetyChecks(false); options.EnableThreadSafetyChecks(false);
}, mareConfig.GetValue("DbContextPoolSize", 1024)); }, mareConfig.GetValue("DbContextPoolSize", 1024));
services.AddHostedService(provider => provider.GetService<SystemInfoService>());
services.AddAuthentication(options => services.AddAuthentication(options =>
{ {
options.DefaultScheme = SecretKeyGrpcAuthenticationHandler.AuthScheme; options.DefaultScheme = SecretKeyGrpcAuthenticationHandler.AuthScheme;
@@ -143,13 +140,15 @@ namespace MareSynchronosServer
opt.InstanceName = "MareSynchronos"; opt.InstanceName = "MareSynchronos";
}); });
services.AddSingleton<IClientIdentificationService, DistributedClientIdentificationService>(); services.AddSingleton<IClientIdentificationService, DistributedClientIdentificationService>();
services.AddHostedService(p => p.GetService<DistributedClientIdentificationService>()); services.AddHostedService(p => p.GetService<IClientIdentificationService>());
} }
else else
{ {
services.AddSingleton<IClientIdentificationService, LocalClientIdentificationService>(); services.AddSingleton<IClientIdentificationService, LocalClientIdentificationService>();
services.AddHostedService(p => p.GetService<LocalClientIdentificationService>()); services.AddHostedService(p => p.GetService<IClientIdentificationService>());
} }
services.AddHostedService(provider => provider.GetService<SystemInfoService>());
} }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@@ -61,12 +61,12 @@ public class Startup
opt.InstanceName = "MareSynchronos"; opt.InstanceName = "MareSynchronos";
}); });
services.AddSingleton<IClientIdentificationService, DistributedClientIdentificationService>(); services.AddSingleton<IClientIdentificationService, DistributedClientIdentificationService>();
services.AddHostedService(p => p.GetService<DistributedClientIdentificationService>()); services.AddHostedService(p => p.GetService<IClientIdentificationService>());
} }
else else
{ {
services.AddSingleton<IClientIdentificationService, LocalClientIdentificationService>(); services.AddSingleton<IClientIdentificationService, LocalClientIdentificationService>();
services.AddHostedService(p => p.GetService<LocalClientIdentificationService>()); services.AddHostedService(p => p.GetService<IClientIdentificationService>());
} }
} }