Compare commits
3 Commits
5400e0c873
...
ded577f40a
Author | SHA1 | Date | |
---|---|---|---|
ded577f40a | |||
32621515db | |||
fdf0ecc9ef |
@ -6,6 +6,7 @@ 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)]);
|
||||
}
|
@ -206,15 +206,17 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
|
||||
[HttpPost("SetLogging")]
|
||||
[TokenAuthentication]
|
||||
[BadRequestResponse]
|
||||
public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request)
|
||||
public ActionResult<bool> SetLogging([FromBody] LoggingRequest? request = null)
|
||||
{
|
||||
var settings = (request == null) switch
|
||||
{
|
||||
true => new LogSettings
|
||||
{
|
||||
EnableLogToFile = true,
|
||||
LogFileName = "logging-",
|
||||
LogFilePath = "logs"
|
||||
LogFileName = "log-",
|
||||
LogFilePath = OperatingSystem.IsWindows() || PathBuilder.IsDefaultPath ?
|
||||
PathBuilder.Combine("logs") :
|
||||
"/var/log/mirea"
|
||||
},
|
||||
false => new LogSettings
|
||||
{
|
||||
@ -234,7 +236,7 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
|
||||
[HttpPost("SetEmail")]
|
||||
[TokenAuthentication]
|
||||
[BadRequestResponse]
|
||||
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request)
|
||||
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request = null)
|
||||
{
|
||||
var settings = (request == null) switch
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user