Compare commits

..

No commits in common. "3085d5e778fb8b45fedd6036e48e9c270f25486e" and "0f1c7581b84e2833be1f33627148f4a3ebe87f56" have entirely different histories.

2 changed files with 16 additions and 20 deletions

View File

@ -4,7 +4,7 @@ var builder = WebApplication.CreateBuilder(args);
var startup = new Startup(builder.Configuration);
startup.ConfigureServices(builder.Services);
await startup.ConfigureServices(builder.Services);
var app = builder.Build();
startup.Configure(app, app.Environment);

View File

@ -12,32 +12,28 @@ public class Startup(IConfiguration configuration)
{
private IConfiguration Configuration { get; } = configuration;
public void ConfigureServices(IServiceCollection services)
public async Task ConfigureServices(IServiceCollection services)
{
services.AddGrpc();
services.AddGrpcReflection();
services.AddControllers();
services.AddLogging();
services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
services.AddSingleton<IChannel>(x =>
{
var rabbitMqConnection = new ConnectionFactory
var rabbitMqConnection = await new ConnectionFactory
{
HostName = "rabbitmq"
}.CreateConnectionAsync().Result;
var channel = rabbitMqConnection.CreateChannelAsync().Result;
channel.QueueDeclareAsync(
}.CreateConnectionAsync();
var channel = await rabbitMqConnection.CreateChannelAsync();
await channel.QueueDeclareAsync(
RabbitQueues.AuthQueue,
false,
false,
false,
arguments: null).Wait();
return channel;
});
arguments: null);
services.AddSingleton(channel);
services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));