mirror of
https://github.com/XFox111/MuiCharts.git
synced 2026-04-22 06:51:05 +03:00
- Reworked Infrastructure injection
- Added LettuceEncrypt for HTTPS - Fixed DataContext - Moved connection string to appsettings.json
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LettuceEncrypt" Version="1.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Reflection;
|
||||
using LettuceEncrypt;
|
||||
using MuiCharts.Infrastructure;
|
||||
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
@@ -17,7 +18,8 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
options.SuppressAsyncSuffixInActionNames = false;
|
||||
});
|
||||
builder.Services.AddInfrastructure();
|
||||
|
||||
builder.AddInfrastructure();
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
@@ -26,6 +28,10 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFileName);
|
||||
options.IncludeXmlComments(xmlPath);
|
||||
});
|
||||
|
||||
if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
|
||||
builder.Services.AddLettuceEncrypt()
|
||||
.PersistDataToDirectory(new DirectoryInfo("/persistence"), null);
|
||||
}
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
@@ -35,7 +41,9 @@ WebApplication app = builder.Build();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
// app.UseHttpsRedirection();
|
||||
if (app.Configuration.GetSection("LettuceEncrypt").Exists())
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -4,5 +4,8 @@
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DataContext": "Data Source=app.db"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,8 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"DataContext": "Data Source=/persistence/data.db"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user