Compare commits

...

4 Commits

Author SHA1 Message Date
3085d5e778 Merge pull request '7' (#26) from 7 into dev
Some checks failed
Publish JOBot on dev / Build and deploy (push) Failing after 20s
Reviewed-on: #26
2025-07-25 18:43:50 +02:00
8b1ead20c9 Merge branch 'dev' into 7 2025-07-25 18:43:45 +02:00
176cf194cd fix: fixed migration by lazy load of rabbitmq 2025-07-25 19:43:14 +03:00
17cec6dd64 fix: removed async in lock tasks 2025-07-25 19:04:38 +03:00
2 changed files with 20 additions and 16 deletions

View File

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

View File

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