62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
namespace Fengling.RiskControl.Configuration;
|
|
|
|
public class RiskControlClientOptions
|
|
{
|
|
public RedisOptions Redis { get; set; } = new();
|
|
public EvaluationOptions Evaluation { get; set; } = new();
|
|
public CapOptions Cap { get; set; } = new();
|
|
public SamplingOptions Sampling { get; set; } = new();
|
|
public FailoverOptions RedisFailover { get; set; } = new();
|
|
public ReconciliationOptions Reconciliation { get; set; } = new();
|
|
}
|
|
|
|
public class RedisOptions
|
|
{
|
|
public string ConnectionString { get; set; } = "81.68.223.70:16379,password=sl52788542";
|
|
public string KeyPrefix { get; set; } = "fengling:risk:";
|
|
public int DefaultTtlSeconds { get; set; } = 7200;
|
|
}
|
|
|
|
public class EvaluationOptions
|
|
{
|
|
public int RuleRefreshIntervalSeconds { get; set; } = 30;
|
|
public int HighRiskThreshold { get; set; } = 70;
|
|
public int MediumRiskThreshold { get; set; } = 30;
|
|
}
|
|
|
|
public class CapOptions
|
|
{
|
|
public bool PublisherEnabled { get; set; } = true;
|
|
public string ConnectionName { get; set; } = "Fengling.RiskControl";
|
|
}
|
|
|
|
public class SamplingOptions
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public double DefaultRate { get; set; } = 0.01;
|
|
public List<SamplingRule> Rules { get; set; } = new();
|
|
}
|
|
|
|
public class SamplingRule
|
|
{
|
|
public string Condition { get; set; } = string.Empty;
|
|
public double Rate { get; set; } = 0.01;
|
|
}
|
|
|
|
public class FailoverOptions
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public int QuickFailThresholdSeconds { get; set; } = 5;
|
|
public int DenyNewUsersThresholdSeconds { get; set; } = 30;
|
|
public string Strategy { get; set; } = "DenyNewUsers";
|
|
public bool FallbackToRulesOnly { get; set; } = false;
|
|
}
|
|
|
|
public class ReconciliationOptions
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public string Schedule { get; set; } = "0 4 * * *";
|
|
public int Threshold { get; set; } = 5;
|
|
public int BatchSize { get; set; } = 1000;
|
|
}
|