feat: add maintenance mode
This commit is contained in:
parent
7b779463bb
commit
d1a806545d
@ -0,0 +1,8 @@
|
||||
namespace Mirea.Api.Endpoint.Common.Interfaces;
|
||||
|
||||
public interface IMaintenanceModeNotConfigureService
|
||||
{
|
||||
bool IsMaintenanceMode { get; }
|
||||
|
||||
void DisableMaintenanceMode();
|
||||
}
|
10
Endpoint/Common/Interfaces/IMaintenanceModeService.cs
Normal file
10
Endpoint/Common/Interfaces/IMaintenanceModeService.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Mirea.Api.Endpoint.Common.Interfaces;
|
||||
|
||||
public interface IMaintenanceModeService
|
||||
{
|
||||
bool IsMaintenanceMode { get; }
|
||||
|
||||
void EnableMaintenanceMode();
|
||||
|
||||
void DisableMaintenanceMode();
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Mirea.Api.Endpoint.Common.Interfaces;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Common.Services;
|
||||
|
||||
public class MaintenanceModeNotConfigureService : IMaintenanceModeNotConfigureService
|
||||
{
|
||||
public bool IsMaintenanceMode { get; private set; } = true;
|
||||
|
||||
public void DisableMaintenanceMode() =>
|
||||
IsMaintenanceMode = false;
|
||||
}
|
14
Endpoint/Common/Services/MaintenanceModeService.cs
Normal file
14
Endpoint/Common/Services/MaintenanceModeService.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using Mirea.Api.Endpoint.Common.Interfaces;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Common.Services;
|
||||
|
||||
public class MaintenanceModeService : IMaintenanceModeService
|
||||
{
|
||||
public bool IsMaintenanceMode { get; private set; };
|
||||
|
||||
public void EnableMaintenanceMode() =>
|
||||
IsMaintenanceMode = true;
|
||||
|
||||
public void DisableMaintenanceMode() =>
|
||||
IsMaintenanceMode = false;
|
||||
}
|
@ -51,6 +51,8 @@ public class Program
|
||||
builder.Services.AddPersistence(builder.Configuration.Get<GeneralConfig>()?.DbSettings?.ConnectionStringSql ?? string.Empty);
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddSingleton<IMaintenanceModeNotConfigureService, MaintenanceModeNotConfigureService>();
|
||||
builder.Services.AddSingleton<IMaintenanceModeService, MaintenanceModeService>();
|
||||
builder.Services.AddSingleton<ISetupToken, SetupTokenService>();
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user