69 lines
2.6 KiB
C#
69 lines
2.6 KiB
C#
namespace Monitor.Backend.Application;
|
|
|
|
/// <summary>Backend 的可调参数(保留期等也可以通过 settings 改,这里是默认值与硬上限)。</summary>
|
|
public sealed class BackendOptions
|
|
{
|
|
/// <summary>数据目录:<c>monitor.db</c> 与 <c>raw/</c>。</summary>
|
|
public string DataDirectory { get; set; } = "data";
|
|
|
|
/// <summary>面板的对外地址(用于生成安装命令)。</summary>
|
|
public string? PublicUrl { get; set; }
|
|
|
|
public int Pbkdf2Iterations { get; set; } = 600_000;
|
|
|
|
/// <summary>会话 Cookie 带 Secure 标记(只提供 HTTPS)。本机用 HTTP 调试时才关闭。</summary>
|
|
public bool SecureCookies { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 允许跨域调用 API 的前端来源,逗号分隔(如 <c>http://localhost:5173,https://panel.example.com</c>,或 <c>*</c>);空 = 不允许,只有同源。
|
|
/// 跨域只支持 Bearer 令牌(不带 Cookie),所以不影响会话的安全。
|
|
/// </summary>
|
|
public string? CorsOrigins { get; set; }
|
|
|
|
public TimeSpan SessionLifetime { get; set; } = TimeSpan.FromHours(12);
|
|
|
|
public int LoginAttemptsPerMinute { get; set; } = 10;
|
|
|
|
public int RawRetentionDays { get; set; } = 30;
|
|
|
|
public int TestRawRetentionDays { get; set; } = 90;
|
|
|
|
public int Metric10sRetentionHours { get; set; } = 48;
|
|
|
|
public int Metric1mRetentionDays { get; set; } = 30;
|
|
|
|
public int Metric5mRetentionDays { get; set; } = 365;
|
|
|
|
public int EventRetentionDays { get; set; } = 365;
|
|
|
|
public int HostRetentionDays { get; set; } = 7;
|
|
|
|
/// <summary>分钟窗口在结束之后再等一会儿,让迟到的块先到。</summary>
|
|
public TimeSpan WindowGrace { get; set; } = TimeSpan.FromSeconds(60);
|
|
|
|
public TimeSpan AnalysisPollInterval { get; set; } = TimeSpan.FromSeconds(5);
|
|
|
|
public TimeSpan QueryTimeout { get; set; } = TimeSpan.FromSeconds(10);
|
|
|
|
public int MaxSsePerClient { get; set; } = 4;
|
|
|
|
public int MaxSseTopics { get; set; } = 32;
|
|
|
|
public int MaxPointsPerSeries { get; set; } = 2000;
|
|
|
|
public int MaxMetricsPerQuery { get; set; } = 32;
|
|
|
|
public int MaxCompareAgents { get; set; } = 20;
|
|
|
|
/// <summary>
|
|
/// 测试方案里「固定时长」阶段(没有 <c>duration_s</c> 参数的,例如 connect、hold)的缩放比例,缺省 1。
|
|
/// 只给自动化测试用:端到端测试里把 30 秒的阶段缩短,不用真等。
|
|
/// </summary>
|
|
public double PhaseDurationScale { get; set; } = 1.0;
|
|
|
|
/// <summary>初始管理员(只在没有任何用户时创建)。</summary>
|
|
public string? InitialAdminUser { get; set; }
|
|
|
|
public string? InitialAdminPassword { get; set; }
|
|
}
|