Release v1.0.0 #16
.envDbInitializer.csDependencyInjection.csnuget.config
.gitea/workflows
.gitignoreApiDto
ApiDto.csproj
Backend.slnDockerfileCommon
AuthRoles.csCacheType.csDatabaseType.csOAuthProvider.csPairPeriodTime.csPasswordPolicy.csTwoFactorAuthentication.cs
Requests
Responses
Endpoint
Backend.httpISaveSettings.cs
README.mdCommon
Attributes
BadRequestResponseAttribute.csCacheMaxAgeAttribute.csLocalhostAttribute.csMaintenanceModeIgnoreAttribute.csNotFoundResponseAttribute.csSwaggerDefaultAttribute.csTokenAuthenticationAttribute.cs
Exceptions
Interfaces
MapperDto
AvailableProvidersConverter.csPairPeriodTimeConverter.csPasswordPolicyConverter.csTwoFactorAuthenticationConverter.cs
Services
Configuration
Core
BackgroundTasks
Middleware
CacheMaxAgeMiddleware.csCookieAuthorizationMiddleware.csCustomExceptionHandlerMiddleware.csJwtRevocationMiddleware.csMaintenanceModeMiddleware.cs
Startup
Model
SwaggerOptions
Validation
Controllers
BaseController.cs
Endpoint.csprojProgram.csConfiguration
V1
AuthController.csCampusController.csDisciplineController.csFacultyController.csGroupController.csImportController.csLectureHallController.csProfessorController.csScheduleController.csSecurityController.cs
WeatherForecastController.csSync
WeatherForecast.cswwwroot
css
swagger
Security
Common
CookieNames.cs
DependencyInjection.csDomain
Caching
CookieOptionsParameters.csOAuth2
OAuthProvider.csOAuthUser.csPasswordPolicy.csRequestContextInfo.csTwoFactorAuthenticator.csUser.csInterfaces
Properties
Security.csprojServices
SqlData
Application
Application.csprojDependencyInjection.cs
Common
Cqrs
Campus
Queries
Discipline
Queries
Faculty
Queries
Group
Queries
LectureHall
Queries
Professor
Queries
GetProfessorDetails
GetProfessorDetailsBySearch
GetProfessorList
Schedule
Interfaces
Domain
Domain.csproj
Schedule
Migrations
MysqlMigrations
Migrations
20240601023106_InitialMigration.Designer.cs20240601023106_InitialMigration.cs20241027034820_RemoveUnusedRef.Designer.cs20241027034820_RemoveUnusedRef.csUberDbContextModelSnapshot.cs
MysqlMigrations.csprojPsqlMigrations
Migrations
20240601021702_InitialMigration.Designer.cs20240601021702_InitialMigration.cs20241027032753_RemoveUnusedRef.Designer.cs20241027032753_RemoveUnusedRef.csUberDbContextModelSnapshot.cs
PsqlMigrations.csprojSqliteMigrations
Persistence
Common
BaseDbContext.csConfigurationResolver.csDatabaseProvider.csDbContextFactory.csModelBuilderExtensions.cs
Contexts
Schedule
EntityTypeConfigurations
Persistence.csprojUberDbContext.cs@@ -22,4 +22,17 @@ public class LoggingRequest
|
|||||||
/// Gets or sets the log file path.
|
/// Gets or sets the log file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? LogFilePath { get; set; }
|
public string? LogFilePath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the API key for integrating with Seq, a log aggregation service.
|
||||||
|
/// If provided, logs will be sent to a Seq server using this API key.
|
||||||
|
/// </summary>
|
||||||
|
public string? ApiKeySeq { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the server URL for the Seq logging service.
|
||||||
|
/// This property specifies the Seq server endpoint to which logs will be sent.
|
||||||
|
/// If <see cref="ApiKeySeq"/> is provided, logs will be sent to this server.
|
||||||
|
/// </summary>
|
||||||
|
public string? ApiServerSeq { get; set; }
|
||||||
}
|
}
|
@@ -24,7 +24,6 @@ public class MaintenanceModeMiddleware(RequestDelegate next, IMaintenanceModeSer
|
|||||||
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||||
context.Response.ContentType = "plain/text";
|
context.Response.ContentType = "plain/text";
|
||||||
|
|
||||||
string error;
|
|
||||||
if (maintenanceModeService.IsMaintenanceMode)
|
if (maintenanceModeService.IsMaintenanceMode)
|
||||||
throw new ServerUnavailableException("The service is currently undergoing maintenance. Please try again later.", true);
|
throw new ServerUnavailableException("The service is currently undergoing maintenance. Please try again later.", true);
|
||||||
|
|
||||||
|
@@ -45,6 +45,12 @@ public static class LoggerConfiguration
|
|||||||
rollingInterval: RollingInterval.Day);
|
rollingInterval: RollingInterval.Day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
|
if (generalConfig != null && !string.IsNullOrEmpty(generalConfig.ApiServerSeq) &&
|
||||||
|
Uri.TryCreate(generalConfig.ApiServerSeq, UriKind.Absolute, out var _))
|
||||||
|
configuration.WriteTo.Seq(generalConfig.ApiServerSeq, apiKey: generalConfig.ApiKeySeq);
|
||||||
|
#endif
|
||||||
|
|
||||||
configuration
|
configuration
|
||||||
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning)
|
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning)
|
||||||
.MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning)
|
.MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning)
|
||||||
|
@@ -9,6 +9,8 @@ public class LogSettings : IIsConfigured
|
|||||||
public bool EnableLogToFile { get; set; }
|
public bool EnableLogToFile { get; set; }
|
||||||
public string? LogFilePath { get; set; }
|
public string? LogFilePath { get; set; }
|
||||||
public string? LogFileName { get; set; }
|
public string? LogFileName { get; set; }
|
||||||
|
public string? ApiKeySeq { get; set; }
|
||||||
|
public string? ApiServerSeq { get; set; }
|
||||||
|
|
||||||
public bool IsConfigured()
|
public bool IsConfigured()
|
||||||
{
|
{
|
||||||
|
@@ -22,6 +22,7 @@ using Mirea.Api.Security.Common.Domain;
|
|||||||
using Mirea.Api.Security.Services;
|
using Mirea.Api.Security.Services;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
using Serilog;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -408,6 +409,29 @@ public class SetupController(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request?.ApiServerSeq))
|
||||||
|
{
|
||||||
|
settings.ApiServerSeq = request.ApiServerSeq;
|
||||||
|
settings.ApiKeySeq = request.ApiKeySeq;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.WriteTo.Seq(settings.ApiServerSeq, apiKey: settings.ApiKeySeq)
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
Log.Warning("Testing configuration Seq.");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignoring
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.EnableLogToFile)
|
if (settings.EnableLogToFile)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(settings.LogFileName))
|
if (string.IsNullOrEmpty(settings.LogFileName))
|
||||||
@@ -427,7 +451,9 @@ public class SetupController(
|
|||||||
{
|
{
|
||||||
EnableLogToFile = settings.EnableLogToFile,
|
EnableLogToFile = settings.EnableLogToFile,
|
||||||
LogFileName = settings.LogFileName,
|
LogFileName = settings.LogFileName,
|
||||||
LogFilePath = settings.LogFilePath
|
LogFilePath = settings.LogFilePath,
|
||||||
|
ApiKeySeq = settings.ApiKeySeq,
|
||||||
|
ApiServerSeq = settings.ApiServerSeq
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
|
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.11" />
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.11" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.8.24" />
|
<PackageReference Include="StackExchange.Redis" Version="2.8.24" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
||||||
<PackageReference Include="System.CodeDom" Version="[8.0.0, 9.0.0)" />
|
<PackageReference Include="System.CodeDom" Version="[8.0.0, 9.0.0)" />
|
||||||
|
Reference in New Issue
Block a user