refactor: change namespace
This commit is contained in:
33
Endpoint/Common/Settings/GeneralConfig.cs
Normal file
33
Endpoint/Common/Settings/GeneralConfig.cs
Normal file
@ -0,0 +1,33 @@
|
||||
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.Common.Settings;
|
||||
|
||||
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
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
5
Endpoint/Common/Settings/ISaveSettings.cs
Normal file
5
Endpoint/Common/Settings/ISaveSettings.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Mirea.Api.Endpoint.Common.Settings;
|
||||
public interface ISaveSettings
|
||||
{
|
||||
void SaveSetting();
|
||||
}
|
Reference in New Issue
Block a user