mirror of
https://github.com/XFox111/MuiCharts.git
synced 2026-04-22 06:51:05 +03:00
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System.Reflection;
|
|
using LettuceEncrypt;
|
|
using MuiCharts.Infrastructure;
|
|
|
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
|
{
|
|
// Add services to the container.
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddLogging(options =>
|
|
{
|
|
options.AddConfiguration(builder.Configuration.GetSection("Logging"));
|
|
options.AddConsole();
|
|
options.AddDebug();
|
|
options.AddEventSourceLogger();
|
|
});
|
|
|
|
builder.Services.AddControllers(options =>
|
|
{
|
|
options.SuppressAsyncSuffixInActionNames = false;
|
|
});
|
|
|
|
builder.AddInfrastructure();
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen(options =>
|
|
{
|
|
string xmlFileName = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
|
string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFileName);
|
|
options.IncludeXmlComments(xmlPath);
|
|
});
|
|
|
|
if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
|
|
builder.Services.AddLettuceEncrypt()
|
|
.PersistDataToDirectory(new DirectoryInfo(
|
|
builder.Configuration.GetValue<string>("LettuceEncrypt:CertificatesPath") ?? "/persistence"
|
|
), null);
|
|
}
|
|
|
|
WebApplication app = builder.Build();
|
|
{
|
|
// Configure the HTTP request pipeline.
|
|
app.UseExceptionHandler("/error");
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
|
|
if (app.Configuration.GetSection("LettuceEncrypt").Exists())
|
|
app.UseHttpsRedirection();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|