Merge pull request '7' (#26) from 7 into dev
Some checks failed
Publish JOBot on dev / Build and deploy (push) Failing after 20s
Some checks failed
Publish JOBot on dev / Build and deploy (push) Failing after 20s
Reviewed-on: #26
This commit is contained in:
commit
3085d5e778
@ -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);
|
||||
|
@ -12,29 +12,33 @@ 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
|
||||
{
|
||||
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 =>
|
||||
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.AddScoped<HeadHunterService>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user