From 4f90a7d0f1343b069fdc0f614cb22e916bb85047 Mon Sep 17 00:00:00 2001 From: Xander Sigler Date: Tue, 5 Dec 2023 23:14:24 -0800 Subject: [PATCH] Added a logger and broadcasting on ssl port --- AdventOfCode.sln | 10 ++++++++-- AdventOfCode/Controllers/AdventOfCodeController.cs | 1 + AdventOfCode/Dockerfile | 2 +- AdventOfCode/Startup.cs | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AdventOfCode.sln b/AdventOfCode.sln index a40ab78..d8af801 100644 --- a/AdventOfCode.sln +++ b/AdventOfCode.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32929.386 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdventOfCode", "AdventOfCode\AdventOfCode.csproj", "{30F2887D-526F-4068-A581-E20BAF52F900}" EndProject @@ -9,6 +9,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdventOfCode.InputFetcher", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdventOfCode.Tests", "AdventOfCode.Tests\AdventOfCode.Tests.csproj", "{03C0BB76-6521-4B51-B267-346E88678D79}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0AA4CCC1-FCBA-4C0E-BB5F-0F4E41907DC9}" + ProjectSection(SolutionItems) = preProject + .drone.yml = .drone.yml + .gitignore = .gitignore + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/AdventOfCode/Controllers/AdventOfCodeController.cs b/AdventOfCode/Controllers/AdventOfCodeController.cs index e599afc..ac018ec 100644 --- a/AdventOfCode/Controllers/AdventOfCodeController.cs +++ b/AdventOfCode/Controllers/AdventOfCodeController.cs @@ -23,6 +23,7 @@ namespace AdventOfCode.Controllers [Consumes("text/plain")] public AOCResponse Day(int year, int day, AOCVersion version, [FromBody] string input, bool IgnoreLogMessages = false) { + _logger.LogInformation($"Recieving a request for {year} day {day} version {version} with {(IgnoreLogMessages ? "no" : "")}logs"); AOCRequest request = new AOCRequest() { Input = input, Version = version, IgnoreLogMessages = IgnoreLogMessages }; var resp = GetAOCDay(year, day).ExecuteDay(request); return resp; diff --git a/AdventOfCode/Dockerfile b/AdventOfCode/Dockerfile index cd2097c..6164525 100644 --- a/AdventOfCode/Dockerfile +++ b/AdventOfCode/Dockerfile @@ -13,6 +13,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 WORKDIR /app COPY --from=build-env /app/out . ENV ASPNETCORE_ENVIRONMENT=Production -ENV ASPNETCORE_URLS=http://+:80 +ENV ASPNETCORE_URLS=https://+:443;http://+:80 ENTRYPOINT ["dotnet", "AdventOfCode.dll"] diff --git a/AdventOfCode/Startup.cs b/AdventOfCode/Startup.cs index 1be6edb..aea08db 100644 --- a/AdventOfCode/Startup.cs +++ b/AdventOfCode/Startup.cs @@ -39,7 +39,7 @@ namespace AdventOfCode services.AddControllers(); services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "AdventofCode", Version = "v1" }); + c.SwaggerDoc("v1", new OpenApiInfo { Title = "AdventofCode", Version = "v1.0.0" }); }); services.AddControllers(o => o.InputFormatters.Insert(o.InputFormatters.Count, new TextPlainInputFormatter())); services.AddSwaggerGenNewtonsoftSupport(); @@ -56,7 +56,7 @@ namespace AdventOfCode app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1")); - app.UseHttpsRedirection(); + //app.UseHttpsRedirection(); app.UseRouting();