From fdd7ea5a40d75bc37ba5dee77438a8a7a42a99a6 Mon Sep 17 00:00:00 2001 From: troogs Date: Mon, 14 Sep 2026 15:45:24 +0200 Subject: [PATCH] Enhance configuration loading: skip example config in development and update launch settings for local debugging --- FoodsharingSiegen.Server/Extensions.cs | 6 ++++-- FoodsharingSiegen.Server/Pages/AuditView.razor.css.map | 1 + FoodsharingSiegen.Server/Program.cs | 3 ++- FoodsharingSiegen.Server/Properties/launchSettings.json | 7 ++++--- FoodsharingSiegen.Server/Shared/NavMenu.razor.css.map | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 FoodsharingSiegen.Server/Pages/AuditView.razor.css.map create mode 100644 FoodsharingSiegen.Server/Shared/NavMenu.razor.css.map diff --git a/FoodsharingSiegen.Server/Extensions.cs b/FoodsharingSiegen.Server/Extensions.cs index f7e1916..342696a 100644 --- a/FoodsharingSiegen.Server/Extensions.cs +++ b/FoodsharingSiegen.Server/Extensions.cs @@ -72,8 +72,10 @@ namespace FoodsharingSiegen.Server // Check if the directory exists if (Directory.Exists(configDir)) { - // Get all JSON files that start with "appsettings" in the directory and its subdirectories - var configFiles = Directory.EnumerateFiles(configDir, "appsettings*.json", SearchOption.AllDirectories); + // In local development, skip the template-only example config so a debug override + // such as ASPNETCORE_URLS can take effect without changing the container image setup. + var configFiles = Directory.EnumerateFiles(configDir, "appsettings*.json", SearchOption.AllDirectories) + .Where(file => !builder.Environment.IsDevelopment() || !Path.GetFileName(file).Equals("appsettings.example.json", StringComparison.OrdinalIgnoreCase)); // Add each file to the configuration foreach (var file in configFiles) builder.Configuration.AddJsonFile(file, true, true); diff --git a/FoodsharingSiegen.Server/Pages/AuditView.razor.css.map b/FoodsharingSiegen.Server/Pages/AuditView.razor.css.map new file mode 100644 index 0000000..52c9276 --- /dev/null +++ b/FoodsharingSiegen.Server/Pages/AuditView.razor.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["AuditView.razor.scss"],"names":[],"mappings":"AAAA;EACE","file":"AuditView.razor.css"} \ No newline at end of file diff --git a/FoodsharingSiegen.Server/Program.cs b/FoodsharingSiegen.Server/Program.cs index 354ed8c..6dd8dc6 100644 --- a/FoodsharingSiegen.Server/Program.cs +++ b/FoodsharingSiegen.Server/Program.cs @@ -14,7 +14,8 @@ using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); builder.LoadAppSettings(); -builder.WebHost.UseUrls("http://+:8700"); +// Keep the app default binding in config for Docker/container deployment. +// Local debugging can override it via ASPNETCORE_URLS in launchSettings. // Add services to the container. builder.Services.AddRazorPages(); diff --git a/FoodsharingSiegen.Server/Properties/launchSettings.json b/FoodsharingSiegen.Server/Properties/launchSettings.json index 1597c77..1f55993 100644 --- a/FoodsharingSiegen.Server/Properties/launchSettings.json +++ b/FoodsharingSiegen.Server/Properties/launchSettings.json @@ -12,10 +12,11 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "launchUrl": "http://localhost:56000/", - "applicationUrl": "http://localhost:56000", + "launchUrl": "http://localhost:5010/", + "applicationUrl": "http://localhost:5010", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_URLS": "http://localhost:5010" } }, "IIS Express": { diff --git a/FoodsharingSiegen.Server/Shared/NavMenu.razor.css.map b/FoodsharingSiegen.Server/Shared/NavMenu.razor.css.map new file mode 100644 index 0000000..49cf3e5 --- /dev/null +++ b/FoodsharingSiegen.Server/Shared/NavMenu.razor.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["NavMenu.razor.scss"],"names":[],"mappings":"AAEA;EACI;;AAEA;EAHJ;IAIQ;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EATJ;IAUQ;IACA;;;;AAKZ;EACI;EACA;EACA;EACA;;;AAGJ;EACI;EACA;;;AAGA;EACI;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;;;AAGR;EACI;EACA;;;AAGJ;EACI;EACA","file":"NavMenu.razor.css"} \ No newline at end of file