feat: created auth hook on TClient
This commit is contained in:
@@ -23,17 +23,17 @@ public static class Startup
|
||||
{
|
||||
services.AddSingleton(config);
|
||||
|
||||
services.AddScoped<ChannelBase, GrpcChannel>(_ => GrpcChannel.ForAddress(config.GetValue<string>("BackendHost")
|
||||
?? throw new MissingFieldException("Host is not defined")));
|
||||
services.AddSingleton(_ => GrpcChannel.ForAddress(config.GetValue<string>("BackendHost")
|
||||
?? throw new MissingFieldException("Host is not defined")));
|
||||
|
||||
#region Commands
|
||||
|
||||
services.AddScoped<StartCommand>();
|
||||
services.AddScoped<MenuCommand>();
|
||||
services.AddScoped<InfoCommand>();
|
||||
services.AddSingleton<StartCommand>();
|
||||
services.AddSingleton<MenuCommand>();
|
||||
services.AddSingleton<InfoCommand>();
|
||||
|
||||
//buttons
|
||||
services.AddScoped<EulaAgreementButtonCommand>();
|
||||
services.AddSingleton<EulaAgreementButtonCommand>();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,21 +46,21 @@ public static class Startup
|
||||
#region Services
|
||||
|
||||
services.AddSingleton<UserService>();
|
||||
services.AddScoped<PrepareUserService>();
|
||||
services.AddScoped<MenuService>();
|
||||
services.AddSingleton<PrepareUserService>();
|
||||
services.AddSingleton<MenuService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region States
|
||||
|
||||
services.AddScoped<PrepareUserState>();
|
||||
services.AddSingleton<PrepareUserState>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region RabbitMQ Clients
|
||||
|
||||
var factory = new ConnectionFactory { HostName = "localhost" };
|
||||
using var connection = factory.CreateConnectionAsync().Result;
|
||||
var factory = new ConnectionFactory { HostName = "rabbitmq" };
|
||||
var connection = factory.CreateConnectionAsync().Result;
|
||||
var channel = connection.CreateChannelAsync().Result;
|
||||
|
||||
channel.QueueDeclareAsync(
|
||||
@@ -69,8 +69,9 @@ public static class Startup
|
||||
false,
|
||||
false,
|
||||
arguments: null).Wait();
|
||||
|
||||
services.AddSingleton<AuthQueue>();
|
||||
|
||||
services.AddSingleton(channel);
|
||||
services.AddHostedService<AuthQueue>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user