Enhance configuration loading: skip example config in development and update launch settings for local debugging
This commit is contained in:
@@ -72,8 +72,10 @@ namespace FoodsharingSiegen.Server
|
|||||||
// Check if the directory exists
|
// Check if the directory exists
|
||||||
if (Directory.Exists(configDir))
|
if (Directory.Exists(configDir))
|
||||||
{
|
{
|
||||||
// Get all JSON files that start with "appsettings" in the directory and its subdirectories
|
// In local development, skip the template-only example config so a debug override
|
||||||
var configFiles = Directory.EnumerateFiles(configDir, "appsettings*.json", SearchOption.AllDirectories);
|
// 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
|
// Add each file to the configuration
|
||||||
foreach (var file in configFiles) builder.Configuration.AddJsonFile(file, true, true);
|
foreach (var file in configFiles) builder.Configuration.AddJsonFile(file, true, true);
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sourceRoot":"","sources":["AuditView.razor.scss"],"names":[],"mappings":"AAAA;EACE","file":"AuditView.razor.css"}
|
||||||
@@ -14,7 +14,8 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.LoadAppSettings();
|
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.
|
// Add services to the container.
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
|
|||||||
@@ -12,10 +12,11 @@
|
|||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "http://localhost:56000/",
|
"launchUrl": "http://localhost:5010/",
|
||||||
"applicationUrl": "http://localhost:56000",
|
"applicationUrl": "http://localhost:5010",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_URLS": "http://localhost:5010"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
|
|||||||
@@ -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"}
|
||||||
Reference in New Issue
Block a user