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 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 PathToSave => Environment.GetEnvironmentVariable("PATH_TO_SAVE") ?? Directory.GetCurrentDirectory();
public static string Combine(params string[] paths) => Path.Combine([.. paths.Prepend(PathToSave)]); 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")] [HttpPost("SetLogging")]
[TokenAuthentication] [TokenAuthentication]
[BadRequestResponse] [BadRequestResponse]
public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request = null) public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request)
{ {
var settings = (request == null) switch var settings = (request == null) switch
{ {
true => new LogSettings true => new LogSettings
{ {
EnableLogToFile = true, EnableLogToFile = true,
LogFileName = "log-", LogFileName = "logging-",
LogFilePath = OperatingSystem.IsWindows() || PathBuilder.IsDefaultPath ? LogFilePath = "logs"
PathBuilder.Combine("logs") :
"/var/log/mirea"
}, },
false => new LogSettings false => new LogSettings
{ {
@ -236,7 +234,7 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
[HttpPost("SetEmail")] [HttpPost("SetEmail")]
[TokenAuthentication] [TokenAuthentication]
[BadRequestResponse] [BadRequestResponse]
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request = null) public ActionResult<bool> SetEmail([FromBody] EmailRequest? request)
{ {
var settings = (request == null) switch var settings = (request == null) switch
{ {