mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 03:56:45 +00:00
⚗️ add fastapi/quart uvicorn configs
This commit is contained in:
@ -69,13 +69,13 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档
|
|||||||
|
|
||||||
* **类型**
|
* **类型**
|
||||||
|
|
||||||
`bool`
|
`Optional[bool]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* **说明**
|
* **说明**
|
||||||
|
|
||||||
开启冷重载,默认会在配置了 app 的 debug 模式启用
|
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档
|
|||||||
|
|
||||||
* **类型**
|
* **类型**
|
||||||
|
|
||||||
`List[str]`
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档
|
|||||||
|
|
||||||
* **类型**
|
* **类型**
|
||||||
|
|
||||||
`List[str]`
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档
|
|||||||
|
|
||||||
* **类型**
|
* **类型**
|
||||||
|
|
||||||
`List[str]`
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,18 +17,78 @@ sidebarDepth: 0
|
|||||||
Quart 驱动框架设置
|
Quart 驱动框架设置
|
||||||
|
|
||||||
|
|
||||||
### `quart_reload_dirs`
|
### `quart_reload`
|
||||||
|
|
||||||
|
|
||||||
* **类型**
|
* **类型**
|
||||||
|
|
||||||
`List[str]`
|
`Optional[bool]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* **说明**
|
* **说明**
|
||||||
|
|
||||||
`debug` 模式下重载监控文件夹列表,默认为 uvicorn 默认值
|
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `quart_reload_dirs`
|
||||||
|
|
||||||
|
|
||||||
|
* **类型**
|
||||||
|
|
||||||
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* **说明**
|
||||||
|
|
||||||
|
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `quart_reload_delay`
|
||||||
|
|
||||||
|
|
||||||
|
* **类型**
|
||||||
|
|
||||||
|
`Optional[float]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* **说明**
|
||||||
|
|
||||||
|
重载延迟,默认为 uvicorn 默认值
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `quart_reload_includes`
|
||||||
|
|
||||||
|
|
||||||
|
* **类型**
|
||||||
|
|
||||||
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* **说明**
|
||||||
|
|
||||||
|
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `quart_reload_excludes`
|
||||||
|
|
||||||
|
|
||||||
|
* **类型**
|
||||||
|
|
||||||
|
`Optional[List[str]]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* **说明**
|
||||||
|
|
||||||
|
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,21 +74,21 @@ class Config(BaseSettings):
|
|||||||
|
|
||||||
``redoc`` 地址,默认为 ``None`` 即关闭
|
``redoc`` 地址,默认为 ``None`` 即关闭
|
||||||
"""
|
"""
|
||||||
fastapi_reload: bool = False
|
fastapi_reload: Optional[bool] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
:类型:
|
||||||
|
|
||||||
``bool``
|
``Optional[bool]``
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
开启冷重载,默认会在配置了 app 的 debug 模式启用
|
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
|
||||||
"""
|
"""
|
||||||
fastapi_reload_dirs: List[str] = []
|
fastapi_reload_dirs: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
:类型:
|
||||||
|
|
||||||
``List[str]``
|
``Optional[List[str]]``
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -104,21 +104,21 @@ class Config(BaseSettings):
|
|||||||
|
|
||||||
重载延迟,默认为 uvicorn 默认值
|
重载延迟,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
fastapi_reload_includes: List[str] = []
|
fastapi_reload_includes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
:类型:
|
||||||
|
|
||||||
``List[str]``
|
``Optional[List[str]]``
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
fastapi_reload_excludes: List[str] = []
|
fastapi_reload_excludes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
:类型:
|
||||||
|
|
||||||
``List[str]``
|
``Optional[List[str]]``
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -257,12 +257,13 @@ class Driver(ReverseDriver, ForwardDriver):
|
|||||||
app or self.server_app, # type: ignore
|
app or self.server_app, # type: ignore
|
||||||
host=host or str(self.config.host),
|
host=host or str(self.config.host),
|
||||||
port=port or self.config.port,
|
port=port or self.config.port,
|
||||||
reload=self.fastapi_config.fastapi_reload or
|
reload=self.fastapi_config.fastapi_reload
|
||||||
|
if self.fastapi_config.fastapi_reload is not None else
|
||||||
(bool(app) and self.config.debug),
|
(bool(app) and self.config.debug),
|
||||||
reload_dirs=self.fastapi_config.fastapi_reload_dirs or None,
|
reload_dirs=self.fastapi_config.fastapi_reload_dirs,
|
||||||
reload_delay=self.fastapi_config.fastapi_reload_delay,
|
reload_delay=self.fastapi_config.fastapi_reload_delay,
|
||||||
reload_includes=self.fastapi_config.fastapi_reload_includes or None,
|
reload_includes=self.fastapi_config.fastapi_reload_includes,
|
||||||
reload_excludes=self.fastapi_config.fastapi_reload_excludes or None,
|
reload_excludes=self.fastapi_config.fastapi_reload_excludes,
|
||||||
debug=self.config.debug,
|
debug=self.config.debug,
|
||||||
log_config=LOGGING_CONFIG,
|
log_config=LOGGING_CONFIG,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
@ -40,15 +40,55 @@ class Config(BaseSettings):
|
|||||||
"""
|
"""
|
||||||
Quart 驱动框架设置
|
Quart 驱动框架设置
|
||||||
"""
|
"""
|
||||||
quart_reload_dirs: List[str] = []
|
quart_reload: Optional[bool] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
:类型:
|
||||||
|
|
||||||
``List[str]``
|
``Optional[bool]``
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``debug`` 模式下重载监控文件夹列表,默认为 uvicorn 默认值
|
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
|
||||||
|
"""
|
||||||
|
quart_reload_dirs: Optional[List[str]] = None
|
||||||
|
"""
|
||||||
|
:类型:
|
||||||
|
|
||||||
|
``Optional[List[str]]``
|
||||||
|
|
||||||
|
:说明:
|
||||||
|
|
||||||
|
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||||
|
"""
|
||||||
|
quart_reload_delay: Optional[float] = None
|
||||||
|
"""
|
||||||
|
:类型:
|
||||||
|
|
||||||
|
``Optional[float]``
|
||||||
|
|
||||||
|
:说明:
|
||||||
|
|
||||||
|
重载延迟,默认为 uvicorn 默认值
|
||||||
|
"""
|
||||||
|
quart_reload_includes: Optional[List[str]] = None
|
||||||
|
"""
|
||||||
|
:类型:
|
||||||
|
|
||||||
|
``Optional[List[str]]``
|
||||||
|
|
||||||
|
:说明:
|
||||||
|
|
||||||
|
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
|
"""
|
||||||
|
quart_reload_excludes: Optional[List[str]] = None
|
||||||
|
"""
|
||||||
|
:类型:
|
||||||
|
|
||||||
|
``Optional[List[str]]``
|
||||||
|
|
||||||
|
:说明:
|
||||||
|
|
||||||
|
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@ -147,8 +187,13 @@ class Driver(ReverseDriver):
|
|||||||
app or self.server_app, # type: ignore
|
app or self.server_app, # type: ignore
|
||||||
host=host or str(self.config.host),
|
host=host or str(self.config.host),
|
||||||
port=port or self.config.port,
|
port=port or self.config.port,
|
||||||
reload=bool(app) and self.config.debug,
|
reload=self.quart_config.quart_reload
|
||||||
reload_dirs=self.quart_config.quart_reload_dirs or None,
|
if self.quart_config.quart_reload is not None else
|
||||||
|
(bool(app) and self.config.debug),
|
||||||
|
reload_dirs=self.quart_config.quart_reload_dirs,
|
||||||
|
reload_delay=self.quart_config.quart_reload_delay,
|
||||||
|
reload_includes=self.quart_config.quart_reload_includes,
|
||||||
|
reload_excludes=self.quart_config.quart_reload_excludes,
|
||||||
debug=self.config.debug,
|
debug=self.config.debug,
|
||||||
log_config=LOGGING_CONFIG,
|
log_config=LOGGING_CONFIG,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
@ -6,12 +6,13 @@ sidebar: auto
|
|||||||
|
|
||||||
## v2.0.0a16
|
## v2.0.0a16
|
||||||
|
|
||||||
- 新增 `MessageFormatter` 可用于 `Message` 的模板生成
|
- 新增 `MessageTemplate` 可用于 `Message` 的模板生成
|
||||||
- 新增 `matcher.got` `matcher.send` `matcher.pause` `matcher.reject` `matcher.finish` 支持 `MessageFormatter`
|
- 新增 `matcher.got` `matcher.send` `matcher.pause` `matcher.reject` `matcher.finish` 支持 `MessageTemplate`
|
||||||
- 移除 `matcher.got` 原本的 `state format` 支持,由 `MessageFormatter` template 替代
|
- 移除 `matcher.got` 原本的 `state format` 支持,由 `MessageTemplate` template 替代
|
||||||
- `adapter` 基类拆分为单独文件
|
- `adapter` 基类拆分为单独文件
|
||||||
- 修复 `fastapi` Driver Websocket 未能正确提供请求头部
|
- 修复 `fastapi` Driver Websocket 未能正确提供请求头部
|
||||||
- 新增 `fastapi` Driver 更多的 uvicorn 相关配置项
|
- 新增 `fastapi` Driver 更多的 uvicorn 相关配置项
|
||||||
|
- 新增 `quart` Driver 更多的 uvicorn 相关配置项
|
||||||
|
|
||||||
## v2.0.0a15
|
## v2.0.0a15
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user