refactor: simplify Program.cs and clean up NuGet.Config
This commit is contained in:
@@ -3,11 +3,11 @@ using HrynCo.NotificationService.DAL.EF;
|
||||
using HrynCo.NotificationService.Services;
|
||||
using Scalar.AspNetCore;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.AddSerilog();
|
||||
|
||||
var appSettings = builder.Configuration
|
||||
AppSettings appSettings = builder.Configuration
|
||||
.GetSection(AppSettings.SectionName)
|
||||
.Get<AppSettings>() ?? throw new InvalidOperationException("App settings are not configured.");
|
||||
|
||||
@@ -18,17 +18,14 @@ builder.Services.AddControllersWithViews()
|
||||
builder.Services.AddNotificationDataAccess(appSettings.ConnectionString);
|
||||
builder.Services.AddNotificationServices();
|
||||
|
||||
var app = builder.Build();
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.MapOpenApi();
|
||||
app.MapScalarApiReference(options =>
|
||||
{
|
||||
app.MapOpenApi();
|
||||
app.MapScalarApiReference(options =>
|
||||
{
|
||||
options.Title = "HrynCo Notification Service";
|
||||
options.Theme = ScalarTheme.DeepSpace;
|
||||
});
|
||||
}
|
||||
options.Title = "HrynCo Notification Service";
|
||||
options.Theme = ScalarTheme.DeepSpace;
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
Reference in New Issue
Block a user