CORS, Theme, Better flow and dotnet tools
This commit is contained in:
28
Server/Models/AppSettingsRepository.cs
Normal file
28
Server/Models/AppSettingsRepository.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Expose.MyIT.Server.Models;
|
||||
|
||||
public class AppSettingsRepository : IAppSettingsRepository
|
||||
{
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public AppSettingsRepository(AppSettings appSettings) => _AppSettings = appSettings;
|
||||
|
||||
public List<string> GetAppSettings()
|
||||
{
|
||||
List<string> results = new();
|
||||
string json = JsonSerializer.Serialize(_AppSettings);
|
||||
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
JsonProperty[] jsonProperties = jsonElement.EnumerateObject().ToArray();
|
||||
foreach (JsonProperty jsonProperty in jsonProperties)
|
||||
results.Add(jsonProperty.Value.ToString());
|
||||
if (!_AppSettings.IsDevelopment)
|
||||
throw new Exception("Shouldn't expose!");
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IAppSettingsRepository.GetAppSettings() => GetAppSettings();
|
||||
|
||||
}
|
Reference in New Issue
Block a user