Some Configuration for this Project

This commit is contained in:
Francesco D'Amico
2025-01-08 11:30:50 +01:00
parent 2802030de1
commit 08c567b9ba
3 changed files with 81 additions and 3 deletions
@@ -8,7 +8,20 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.11" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
@@ -16,6 +29,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Sentry.Serilog" Version="4.13.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+26 -1
View File
@@ -1,4 +1,26 @@
var builder = WebApplication.CreateBuilder(args);
using Francesco.Recipes.World.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Serilog;
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var configuration = builder.Configuration;
services.AddLogging(
loggingBuilder =>
loggingBuilder.AddSerilog(
new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger()));
var connectionString = builder.Configuration.GetConnectionString("FrancescosRecipesWorldDbContextConnection")
?? throw new InvalidOperationException("Connection string 'RecruitmentToolDbContextConnection' not found.");
services.AddDbContext<FrancescosRecipesWorldDbContext>(options =>
options.UseSqlServer(connectionString));
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<FrancescosRecipesWorldDbContext>();
// Add services to the container.
builder.Services.AddControllersWithViews();
@@ -18,9 +40,12 @@ app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapDefaultControllerRoute();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
+38 -1
View File
@@ -5,5 +5,42 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"ConnectionStrings": {
"FrancescosRecipesWorldDbContextConnection": "Server=localhost\\SQLEXPRESS;Database=Francesco.Recipes.World; Trusted_Connection=True; MultipleActiveResultSets=true;TrustServerCertificate=True "
},
"EmailConfiguration": {
"Server": "127.0.0.1",
"SmtpPort": 1025,
"User": "",
"Password": "",
"EnableSsl": false,
"From": "mailhog@localhost.net",
"WebUserInterface": "127.0.0.1:8025"
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"System": "Information",
"Microsoft": "Information"
}
},
"WriteTo": [
{
"Name": "Sentry",
"Args": {
"Dsn": "https://84d32207fb244762a68b9d4a5de92495@sentry.intersim.ch/8",
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Debug"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
]
}
}