Fix cert issue

This commit is contained in:
rossmill76 committed 2026-03-07 16:02:49 +00:00
1 parent 65a71c5b5f
commit f5feec81f1
3 files changed
+4 -5

No files matched your search

+4 -5
View File
@@ -1,3 +1,4 @@
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using BudgetApp.Components; using BudgetApp.Components;
@@ -9,10 +10,8 @@ using BudgetApp.Data.Interfaces;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Host.ConfigureWebHostDefaults(webBuilder => builder.WebHost.ConfigureKestrel(options =>
{ {
webBuilder.ConfigureKestrel(options =>
{
options.ConfigureHttpsDefaults(adapterOptions => options.ConfigureHttpsDefaults(adapterOptions =>
{ {
var pemCertFile = "app/data/certs/cert.pem"; var pemCertFile = "app/data/certs/cert.pem";
@@ -20,7 +19,7 @@ builder.Host.ConfigureWebHostDefaults(webBuilder =>
if (File.Exists(pemCertFile) && File.Exists(pemKeyFile)) if (File.Exists(pemCertFile) && File.Exists(pemKeyFile))
{ {
adapterOptions.ServerCertificate = System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromPemFile(pemCertFile, pemKeyFile); adapterOptions.ServerCertificate = X509Certificate2.CreateFromPemFile(pemCertFile, pemKeyFile);
} }
else else
{ {
@@ -28,7 +27,6 @@ builder.Host.ConfigureWebHostDefaults(webBuilder =>
adapterOptions.ServerCertificate = null; adapterOptions.ServerCertificate = null;
} }
}); });
});
}); });
// Database // Database
@@ -121,6 +119,7 @@ builder.Services.AddRazorComponents()
var app = builder.Build(); var app = builder.Build();
// Auto-migrate database // Auto-migrate database
using (var scope = app.Services.CreateScope()) using (var scope = app.Services.CreateScope())
{ {
Binary file not shown.
Binary file not shown.