自建邮箱版本
This commit is contained in:
@@ -53,6 +53,13 @@ class EmailConfig:
|
||||
file_path: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class SelfHostedEmailConfig:
|
||||
"""自建邮箱配置"""
|
||||
api_base_url: str
|
||||
api_key: Optional[str] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServerConfig:
|
||||
hostname: str
|
||||
@@ -100,6 +107,7 @@ class Config:
|
||||
captcha_config: CaptchaConfig = None
|
||||
server_config: Optional[ServerConfig] = None
|
||||
auto_service_config: Optional[AutoServiceConfig] = None
|
||||
self_hosted_email_config: Optional[SelfHostedEmailConfig] = None
|
||||
hostname: Optional[str] = None # 向后兼容
|
||||
|
||||
@classmethod
|
||||
@@ -137,6 +145,9 @@ class Config:
|
||||
# 创建自动服务配置对象
|
||||
auto_service_config = AutoServiceConfig(**data.get('auto_service', {})) if 'auto_service' in data else None
|
||||
|
||||
# 创建自建邮箱配置对象
|
||||
self_hosted_email_config = SelfHostedEmailConfig(**data.get('self_hosted_email', {})) if 'self_hosted_email' in data else None
|
||||
|
||||
# 设置hostname (优先使用server_config中的hostname)
|
||||
hostname = None
|
||||
if server_config and hasattr(server_config, 'hostname'):
|
||||
@@ -152,5 +163,6 @@ class Config:
|
||||
captcha_config=captcha_config,
|
||||
server_config=server_config,
|
||||
auto_service_config=auto_service_config,
|
||||
self_hosted_email_config=self_hosted_email_config,
|
||||
hostname=hostname
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user