Add DI support to CliFx
This commit is contained in:
@@ -28,21 +28,26 @@ namespace Akari.Prototype.Server
|
||||
{
|
||||
services.AddGrpc();
|
||||
|
||||
ConfigureStandardServices(Configuration, services);
|
||||
|
||||
services.AddHostedService<TcpProviderService>();
|
||||
services.AddHostedService<AuthLifetimeService>();
|
||||
}
|
||||
|
||||
public static void ConfigureStandardServices(IConfiguration configuration, IServiceCollection services)
|
||||
{
|
||||
services.AddOptions<TcpProviderOptions>()
|
||||
.Bind(Configuration.GetSection(TcpProviderOptions.SectionPath))
|
||||
.Bind(configuration.GetSection(TcpProviderOptions.SectionPath))
|
||||
.ValidateDataAnnotations();
|
||||
|
||||
services.AddOptions<AkariOptions>()
|
||||
.Bind(Configuration.GetSection(AkariOptions.SectionPath))
|
||||
.Bind(configuration.GetSection(AkariOptions.SectionPath))
|
||||
.ValidateDataAnnotations();
|
||||
|
||||
services.AddSingleton<IFingerprintManager, FingerprintManager>();
|
||||
services.AddSingleton<IAuthManager, AuthManager>();
|
||||
services.AddSingleton<IKeyManager, KeyManager>();
|
||||
services.AddSingleton<AkariPath>();
|
||||
|
||||
services.AddHostedService<TcpProviderService>();
|
||||
services.AddHostedService<AuthLifetimeService>();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
Reference in New Issue
Block a user