backend for logging

This commit is contained in:
root
2024-05-02 11:11:12 +00:00
parent 8e4322649e
commit 0ecfcd5a9a
259 changed files with 4111 additions and 709 deletions
+4 -25
View File
@@ -9,32 +9,11 @@ using Microsoft.AspNetCore.Server.Kestrel.Https;
var builder = WebApplication.CreateBuilder(args);
// Specify the paths to your certificate and key files
var certPath = Path.Combine(Directory.GetCurrentDirectory(), "cert.pem");
var keyPath = Path.Combine(Directory.GetCurrentDirectory(), "key.pem");
// Load the certificate and key
var certificate = new X509Certificate2(certPath);
var privateKeyText = File.ReadAllText(keyPath);
var rsaPrivateKey = RSA.Create();
rsaPrivateKey.ImportFromPem(privateKeyText.ToCharArray());
// Combine the certificate and private key into one X509Certificate2 object
var certificateWithKey = certificate.CopyWithPrivateKey(rsaPrivateKey);
builder.WebHost.ConfigureKestrel(serverOptions =>
// Configure Kestrel with certificate paths from appsettings.json
builder.WebHost.ConfigureKestrel((context, serverOptions) =>
{
serverOptions.ListenAnyIP(5000); // Set HTTP port
serverOptions.ListenAnyIP(5001, listenOptions => // Set HTTPS port
{
// Apply the certificate with the private key to HTTPS
listenOptions.UseHttps(new HttpsConnectionAdapterOptions
{
ServerCertificate = certificateWithKey,
ClientCertificateMode = ClientCertificateMode.NoCertificate
});
});
});;
serverOptions.Configure(context.Configuration.GetSection("Kestrel"), reloadOnChange: true);
});
builder.Services.AddCors(options =>
{