在 MiGu 侧落地日志定时清理与磁盘空间告警。
系统配置可开关清理策略;日志管理页支持查看/保存清理选项。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiGu.Server.Configs;
|
||||
using MiGu.Server.Logs;
|
||||
|
||||
namespace MiGu.Server.Controllers;
|
||||
|
||||
@@ -13,10 +14,12 @@ namespace MiGu.Server.Controllers;
|
||||
public class ConfigController : ControllerBase
|
||||
{
|
||||
private readonly ConfigStore _store;
|
||||
private readonly LogCleanupService _cleanup;
|
||||
|
||||
public ConfigController(ConfigStore store)
|
||||
public ConfigController(ConfigStore store, LogCleanupService cleanup)
|
||||
{
|
||||
_store = store;
|
||||
_cleanup = cleanup;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -66,6 +69,8 @@ public class ConfigController : ControllerBase
|
||||
}
|
||||
|
||||
var env = _store.Put(section, payload);
|
||||
if (string.Equals(section, "system", StringComparison.OrdinalIgnoreCase))
|
||||
_cleanup.ApplySchedule();
|
||||
return Ok(new
|
||||
{
|
||||
section = env.Section,
|
||||
|
||||
Reference in New Issue
Block a user