Compare commits

..

No commits in common. "ded577f40acb67424b150fbf35cb117ec1b75d0e" and "5400e0c8737704f04de2afd03c28bbe520266a90" have entirely different histories.

2 changed files with 4 additions and 7 deletions

View File

@ -6,7 +6,6 @@ namespace Mirea.Api.Endpoint.Common.Services;
public static class PathBuilder
{
public static bool IsDefaultPath => Environment.GetEnvironmentVariable("PATH_TO_SAVE") == null;
public static string PathToSave => Environment.GetEnvironmentVariable("PATH_TO_SAVE") ?? Directory.GetCurrentDirectory();
public static string Combine(params string[] paths) => Path.Combine([.. paths.Prepend(PathToSave)]);
}

View File

@ -206,17 +206,15 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
[HttpPost("SetLogging")]
[TokenAuthentication]
[BadRequestResponse]
public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request = null)
public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request)
{
var settings = (request == null) switch
{
true => new LogSettings
{
EnableLogToFile = true,
LogFileName = "log-",
LogFilePath = OperatingSystem.IsWindows() || PathBuilder.IsDefaultPath ?
PathBuilder.Combine("logs") :
"/var/log/mirea"
LogFileName = "logging-",
LogFilePath = "logs"
},
false => new LogSettings
{
@ -236,7 +234,7 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
[HttpPost("SetEmail")]
[TokenAuthentication]
[BadRequestResponse]
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request = null)
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request)
{
var settings = (request == null) switch
{