This commit is contained in:
2024-05-21 07:47:34 -07:00
parent e32a942fde
commit 13b9731edf

View File

@ -90,9 +90,7 @@ public class AppSettings
Models.AppSettings? results;
string? json;
if (appSettings is null || appSettings.ConfigurationFileName is null)
json = null;
else
{
throw new NotSupportedException($"{nameof(appSettings.ConfigurationFileName)} must be set!");
string jsonFile = Path.Combine(AppContext.BaseDirectory, appSettings.ConfigurationFileName);
if (File.Exists(jsonFile))
json = File.ReadAllText(jsonFile);
@ -109,7 +107,6 @@ public class AppSettings
}
if (string.IsNullOrEmpty(json) && File.Exists(jsonFile))
json = File.ReadAllText(jsonFile);
}
results = (string.IsNullOrEmpty(json) ? null : results = JsonSerializer.Deserialize(json, AppSettingsSourceGenerationContext.Default.AppSettings)) ??
throw new NullReferenceException(nameof(Models.AppSettings));
results = Get(appSettings,