移除.env文件

pull/1496/head
UnCLAS-Prommer 2026-02-05 16:16:44 +08:00
parent 54e9007b8d
commit 4dbe919cfe
No known key found for this signature in database
3 changed files with 14 additions and 5 deletions

View File

@ -7,7 +7,7 @@ version 0.3.0 - 2026-01-11
- [x] 使用 python 方法作为配置项说明(提案)
- [x] 取消`bot_config_template.toml`
- [x] 取消`model_config_template.toml`
- [ ] 取消`template_env`
- [x] 取消`template_env`
- [x] 配置类中的所有原子项目应该只包含以下类型: `str`, `int`, `float`, `bool`, `list`, `dict`, `set`
- [x] 禁止使用 `Union` 类型
- [x] 禁止使用`tuple`类型,使用嵌套`dataclass`替代

View File

@ -1,9 +1,9 @@
import asyncio
from fastapi import FastAPI, APIRouter
from rich.traceback import install
from typing import Optional
from uvicorn import Config, Server as UvicornServer
import asyncio
import os
from rich.traceback import install
install(extra_lines=3)
@ -97,7 +97,11 @@ global_server = None
def get_global_server() -> Server:
"""获取全局服务器实例"""
from src.config.config import global_config
global global_server
if global_server is None:
global_server = Server(host=os.environ["HOST"], port=int(os.environ["PORT"]))
global_server = Server(
host=global_config.maim_message.ws_server_host, port=global_config.maim_message.ws_server_port
)
return global_server

View File

@ -512,6 +512,11 @@ class ExperimentalConfig(ConfigBase):
class MaimMessageConfig(ConfigBase):
"""maim_message配置类"""
ws_server_host: str = "127.0.0.1"
"""旧版基于WS的服务器主机地址"""
ws_server_port: int = 8080
"""旧版基于WS的服务器端口号"""
auth_token: list[str] = Field(default_factory=lambda: [])
"""认证令牌用于旧版API验证为空则不启用验证"""