32 lines
922 B
C#
32 lines
922 B
C#
using Mirea.Api.Endpoint.Common.Services;
|
|
using Mirea.Api.Endpoint.Configuration.General.Settings;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirea.Api.Endpoint.Configuration.General;
|
|
|
|
public class GeneralConfig
|
|
{
|
|
[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 void SaveSetting()
|
|
{
|
|
File.WriteAllText(
|
|
FilePath,
|
|
JsonSerializer.Serialize(this, new JsonSerializerOptions
|
|
{
|
|
WriteIndented = true
|
|
})
|
|
);
|
|
}
|
|
} |