26 lines
782 B
Python
26 lines
782 B
Python
"""风控定时扫描环境配置读取。"""
|
|||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from dataclasses import dataclass
|
||
|
|
|
||
|
|
from app.core.config import get_settings
|
||
|
|
|
||
|
|
|
||
|
|
@dataclass(frozen=True, slots=True)
|
||
|
|
class RiskScanScheduleConfig:
|
||
|
|
enabled: bool = False
|
||
|
|
interval_minutes: int = 5
|
||
|
|
run_immediately: bool = False
|
||
|
|
retry_limit: int = 2
|
||
|
|
|
||
|
|
async def load_risk_scan_schedule_config() -> RiskScanScheduleConfig:
|
||
|
|
"""读取环境变量配置;缺失时使用默认关闭值。"""
|
||
|
|
settings = get_settings()
|
||
|
|
return RiskScanScheduleConfig(
|
||
|
|
enabled=settings.risk_scan_schedule_enabled,
|
||
|
|
interval_minutes=settings.risk_scan_interval_minutes,
|
||
|
|
run_immediately=settings.risk_scan_run_immediately,
|
||
|
|
retry_limit=settings.risk_scan_retry_limit,
|
||
|
|
)
|