- 将清理间隔从硬编码3600秒改为可配置项cleanup_interval_seconds - 文件保留时间从1小时调整为15分钟(0.25小时) - 清理间隔同步调整为15分钟(900秒),保持与保留时间一致 - 优化存储空间使用,过期文件更及时清理
24 lines
570 B
Python
24 lines
570 B
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
|
|
class Settings(BaseSettings):
|
|
# Japi Server 配置
|
|
host: str = "0.0.0.0"
|
|
port: int = 8100
|
|
debug: bool = False
|
|
|
|
# Japi 静态资源下载URL
|
|
download_url: str = "https://api.jingrow.com/files"
|
|
|
|
# 文件保留时间(小时)
|
|
file_retention_hours: float = 0.25 # 15分钟
|
|
|
|
# 清理任务执行间隔(秒)
|
|
cleanup_interval_seconds: int = 900 # 15分钟
|
|
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
# 创建全局配置实例
|
|
settings = Settings() |