fix injectionses
This commit is contained in:
parent
b93115d787
commit
cd078ca643
11 changed files with 119 additions and 55 deletions
|
@ -21,11 +21,16 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddConsole();
|
||||
builder.Logging.AddDebug();
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Information);
|
||||
var loggerFactory = LoggerFactory.Create(b =>
|
||||
{
|
||||
b.SetMinimumLevel(LogLevel.Information)
|
||||
.AddConfiguration(builder.Configuration.GetSection("Logging"))
|
||||
.AddConsole()
|
||||
.AddDebug();
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton(loggerFactory);
|
||||
builder.Services.AddSingleton(typeof(ILogger<>), typeof(Logger<>));
|
||||
|
||||
var connectionString = builder.Configuration.GetConnectionString("Database");
|
||||
if (connectionString is null)
|
||||
|
@ -39,9 +44,9 @@ if (blobStorageRoot is null)
|
|||
var eventBus = new EventBus(Channel.CreateUnbounded<IEvent>());
|
||||
builder.Services.AddHostedService(_ => eventBus);
|
||||
|
||||
builder.Services.InitializeBlogModule(connectionString, eventBus);
|
||||
builder.Services.InitializeBlogModule(connectionString, eventBus, loggerFactory);
|
||||
builder.Services.InitializeMediaModule(connectionString, blobStorageRoot);
|
||||
builder.Services.InitializeAuthenticationModule(connectionString, eventBus);
|
||||
builder.Services.InitializeAuthenticationModule(connectionString, eventBus, loggerFactory);
|
||||
|
||||
builder.Services.AddScoped<CurrentUserContext, CurrentUserContext>();
|
||||
builder.Services.AddScoped<ICurrentUserContext>(s => s.GetRequiredService<CurrentUserContext>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue