Skip to content

Commit

Permalink
remove dummy code
Browse files Browse the repository at this point in the history
  • Loading branch information
3xjn committed Oct 14, 2024
1 parent 99e61dd commit 348d052
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using LettuceEncrypt;
using Microsoft.Extensions.FileProviders;
Expand Down Expand Up @@ -55,21 +56,20 @@
var certPath = "/etc/letsencrypt/live/3xjn.dev/fullchain.pem";
var keyPath = "/etc/letsencrypt/live/3xjn.dev/privkey.pem";

builder.WebHost.ConfigureKestrel(serverOptions =>
// Load the certificates from PEM files
var cert = X509Certificate2.CreateFromPemFile(
certPath,
keyPath);

// Optional: If needed, re-export to ensure compatibility
cert = new X509Certificate2(cert.Export(X509ContentType.Pfx));

// Configure Kestrel to use the certificate
builder.WebHost.ConfigureKestrel(options =>
{
serverOptions.ListenAnyIP(80);
serverOptions.ListenAnyIP(443, listenOptions =>
options.ListenAnyIP(443, listenOptions =>
{
try
{
listenOptions.UseHttps(certPath, keyPath);
}
catch (Exception ex)
{
Console.WriteLine($"Error configuring HTTPS: {ex.Message}");
// Fallback to HTTP if HTTPS configuration fails
serverOptions.ListenAnyIP(80);
}
listenOptions.UseHttps(cert);
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
24 changes: 24 additions & 0 deletions obj/Release/net8.0/TodoAppAPI.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute("9d4cf51f-3e59-4a50-89d5-210f0a2d2238")]
[assembly: System.Reflection.AssemblyCompanyAttribute("TodoAppAPI")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f79d94b727d2c01d988c0936954c7f101010f248")]
[assembly: System.Reflection.AssemblyProductAttribute("TodoAppAPI")]
[assembly: System.Reflection.AssemblyTitleAttribute("TodoAppAPI")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

1 change: 1 addition & 0 deletions obj/Release/net8.0/TodoAppAPI.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
afc4970e5e5182fd93fb388e5c2a0c89ead0e5e1a03a0b9bf6d36e11a527a50a
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = TodoAppAPI
build_property.RootNamespace = TodoAppAPI
build_property.ProjectDir = C:\Users\asher\source\repos\TodoAppAPI\TodoAppAPI\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\asher\source\repos\TodoAppAPI\TodoAppAPI
build_property._RazorSourceGeneratorDebug =
17 changes: 17 additions & 0 deletions obj/Release/net8.0/TodoAppAPI.GlobalUsings.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;
Binary file added obj/Release/net8.0/TodoAppAPI.assets.cache
Binary file not shown.
Binary file not shown.

0 comments on commit 348d052

Please sign in to comment.