Compare commits
No commits in common. "3085d5e778fb8b45fedd6036e48e9c270f25486e" and "0f1c7581b84e2833be1f33627148f4a3ebe87f56" have entirely different histories.
3085d5e778
...
0f1c7581b8
@ -4,7 +4,7 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
var startup = new Startup(builder.Configuration);
|
var startup = new Startup(builder.Configuration);
|
||||||
|
|
||||||
startup.ConfigureServices(builder.Services);
|
await startup.ConfigureServices(builder.Services);
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
startup.Configure(app, app.Environment);
|
startup.Configure(app, app.Environment);
|
||||||
|
@ -12,33 +12,29 @@ public class Startup(IConfiguration configuration)
|
|||||||
{
|
{
|
||||||
private IConfiguration Configuration { get; } = configuration;
|
private IConfiguration Configuration { get; } = configuration;
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public async Task ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddGrpc();
|
services.AddGrpc();
|
||||||
services.AddGrpcReflection();
|
services.AddGrpcReflection();
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
services.AddLogging();
|
services.AddLogging();
|
||||||
|
|
||||||
|
var rabbitMqConnection = await new ConnectionFactory
|
||||||
|
{
|
||||||
|
HostName = "rabbitmq"
|
||||||
|
}.CreateConnectionAsync();
|
||||||
|
var channel = await rabbitMqConnection.CreateChannelAsync();
|
||||||
|
await channel.QueueDeclareAsync(
|
||||||
|
RabbitQueues.AuthQueue,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
arguments: null);
|
||||||
|
services.AddSingleton(channel);
|
||||||
|
|
||||||
services.AddDbContext<AppDbContext>(options =>
|
services.AddDbContext<AppDbContext>(options =>
|
||||||
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
|
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
|
||||||
|
|
||||||
|
|
||||||
services.AddSingleton<IChannel>(x =>
|
|
||||||
{
|
|
||||||
var rabbitMqConnection = new ConnectionFactory
|
|
||||||
{
|
|
||||||
HostName = "rabbitmq"
|
|
||||||
}.CreateConnectionAsync().Result;
|
|
||||||
var channel = rabbitMqConnection.CreateChannelAsync().Result;
|
|
||||||
channel.QueueDeclareAsync(
|
|
||||||
RabbitQueues.AuthQueue,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
arguments: null).Wait();
|
|
||||||
return channel;
|
|
||||||
});
|
|
||||||
|
|
||||||
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));
|
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));
|
||||||
|
|
||||||
services.AddScoped<HeadHunterService>();
|
services.AddScoped<HeadHunterService>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user