2024-10-07 02:25:36 +03:00
|
|
|
|
using Mirea.Api.Endpoint.Common.Services;
|
|
|
|
|
using Mirea.Api.Endpoint.Configuration.Model.GeneralSettings;
|
2024-07-04 23:45:33 +03:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.Json.Serialization;
|
2024-05-28 06:38:24 +03:00
|
|
|
|
|
2024-10-07 02:13:35 +03:00
|
|
|
|
namespace Mirea.Api.Endpoint.Configuration.Model;
|
2024-05-28 06:38:24 +03:00
|
|
|
|
|
2024-07-04 23:54:17 +03:00
|
|
|
|
public class GeneralConfig : ISaveSettings
|
2024-05-28 06:38:24 +03:00
|
|
|
|
{
|
2024-07-04 23:45:33 +03:00
|
|
|
|
[JsonIgnore] private const string FileName = "Settings.json";
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public static string FilePath => PathBuilder.Combine(FileName);
|
2024-05-28 06:38:24 +03:00
|
|
|
|
|
|
|
|
|
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; }
|
2024-07-04 23:46:43 +03:00
|
|
|
|
public string? SecretForwardToken { get; set; }
|
2024-07-04 23:45:33 +03:00
|
|
|
|
|
|
|
|
|
public void SaveSetting()
|
|
|
|
|
{
|
|
|
|
|
File.WriteAllText(
|
|
|
|
|
FilePath,
|
|
|
|
|
JsonSerializer.Serialize(this, new JsonSerializerOptions
|
|
|
|
|
{
|
|
|
|
|
WriteIndented = true
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-05-28 06:38:24 +03:00
|
|
|
|
}
|