using Mirea.Api.Endpoint.Common.Services; using Mirea.Api.Endpoint.Configuration.Model.GeneralSettings; using System.IO; using System.Text.Json; using System.Text.Json.Serialization; namespace Mirea.Api.Endpoint.Configuration.Model; public class GeneralConfig : ISaveSettings { [JsonIgnore] private const string FileName = "Settings.json"; [JsonIgnore] public static string FilePath => PathBuilder.Combine(FileName); public DbSettings? DbSettings { get; set; } public CacheSettings? CacheSettings { get; set; } public ScheduleSettings? ScheduleSettings { get; set; } public EmailSettings? EmailSettings { get; set; } public LogSettings? LogSettings { get; set; } public string? SecretForwardToken { get; set; } public void SaveSetting() { File.WriteAllText( FilePath, JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true }) ); } }