From cd28afcd917c7fef874a876513a60ab136be21a7 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Sun, 29 Jun 2025 17:15:34 +0000 Subject: [PATCH] dont reload appsettings.json at runtime (#2093) * dont reload appsettings.json at runtime * also disable here --- CHANGELOG.md | 1 + .../Queries/GetTroubleshootingInfoHandler.cs | 9 +++++++-- ErsatzTV.Scanner/Program.cs | 1 + ErsatzTV/Program.cs | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0177e8bf..0eb9df88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Allow `Other Video` libraries and `Image` libraries to use the same folders +- Try to mitigate inotify limit error by disabling automatic reloading of `appsettings.json` config files ### Fixed - Fix QSV acceleration in docker with older Intel devices diff --git a/ErsatzTV.Application/Troubleshooting/Queries/GetTroubleshootingInfoHandler.cs b/ErsatzTV.Application/Troubleshooting/Queries/GetTroubleshootingInfoHandler.cs index adb78308..7d516356 100644 --- a/ErsatzTV.Application/Troubleshooting/Queries/GetTroubleshootingInfoHandler.cs +++ b/ErsatzTV.Application/Troubleshooting/Queries/GetTroubleshootingInfoHandler.cs @@ -137,9 +137,14 @@ public class GetTroubleshootingInfoHandler : IRequestHandler(); foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) { - if (de is { Key: string key, Value: string value } && key.StartsWith("ETV_", StringComparison.OrdinalIgnoreCase)) + if (de is { Key: string key, Value: string value }) { - environment[key] = value; + if (key.StartsWith("ETV_", StringComparison.OrdinalIgnoreCase) + || key.StartsWith("DOTNET_", StringComparison.OrdinalIgnoreCase) + || key.StartsWith("ASPNETCORE_", StringComparison.OrdinalIgnoreCase)) + { + environment[key] = value; + } } } diff --git a/ErsatzTV.Scanner/Program.cs b/ErsatzTV.Scanner/Program.cs index 11ba8ee5..3af78e8d 100644 --- a/ErsatzTV.Scanner/Program.cs +++ b/ErsatzTV.Scanner/Program.cs @@ -64,6 +64,7 @@ public class Program try { + Environment.SetEnvironmentVariable("DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE", "false"); await CreateHostBuilder(args).Build().RunAsync(); return 0; } diff --git a/ErsatzTV/Program.cs b/ErsatzTV/Program.cs index 1d6ca156..21508f25 100644 --- a/ErsatzTV/Program.cs +++ b/ErsatzTV/Program.cs @@ -27,7 +27,7 @@ public class Program Configuration = builder .SetBasePath(BasePath) - .AddJsonFile("appsettings.json", false, true) + .AddJsonFile("appsettings.json", false, reloadOnChange: false) .AddJsonFile( $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true) @@ -117,6 +117,7 @@ public class Program try { + Environment.SetEnvironmentVariable("DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE", "false"); await CreateHostBuilder(args).Build().RunAsync(); return 0; }