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