2bbdb00a4d
包含节点账本、每日清算,以及 Ubuntu 交互式部署脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
"""运行参数。可用环境变量或项目根目录的 .env 覆盖。"""
|
|
|
|
from decimal import Decimal
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
database_url: str = "sqlite:///./depin.db"
|
|
# 超过该时长没有心跳,节点会被置为 offline。
|
|
heartbeat_timeout_minutes: int = 15
|
|
# 在线巡检周期。
|
|
offline_check_minutes: int = 5
|
|
# 随机任务下发周期、单轮最多下发数量,以及节点必须回传的时限。
|
|
task_dispatch_minutes: int = 5
|
|
dispatch_batch_size: int = 20
|
|
task_deadline_minutes: int = 10
|
|
# 当日既有在线样本又有任务样本时的权重。两者默认相加为 1。
|
|
online_weight: Decimal = Decimal("0.7")
|
|
task_weight: Decimal = Decimal("0.3")
|
|
# 每日清算时刻。默认北京时间凌晨 00:05,入账的是上一个已结束的 UTC 账本日。
|
|
yield_timezone: str = "Asia/Shanghai"
|
|
yield_hour: int = 0
|
|
yield_minute: int = 5
|
|
license_months: int = 12
|
|
disable_scheduler: bool = False
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
|
|
settings = Settings()
|