Skip to content

Commit

Permalink
✨ Feature: 使用自定义配置加载替代 pydantic-settings (#2521)
Browse files Browse the repository at this point in the history
Co-authored-by: uy/sun <hmy0119@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 15, 2024
1 parent 6c532f5 commit 1153c5f
Show file tree
Hide file tree
Showing 6 changed files with 522 additions and 182 deletions.
5 changes: 2 additions & 3 deletions nonebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@
from typing import Any, Dict, Type, Union, TypeVar, Optional, overload

import loguru
from pydantic.env_settings import DotenvType

from nonebot.config import Env, Config
from nonebot.log import logger as logger
from nonebot.adapters import Bot, Adapter
from nonebot.config import DOTENV_TYPE, Env, Config
from nonebot.utils import escape_tag, resolve_dot_notation
from nonebot.drivers import Driver, ASGIMixin, combine_driver

Expand Down Expand Up @@ -273,7 +272,7 @@ def _log_patcher(record: "loguru.Record"):
)


def init(*, _env_file: Optional[DotenvType] = None, **kwargs: Any) -> None:
def init(*, _env_file: Optional[DOTENV_TYPE] = None, **kwargs: Any) -> None:
"""初始化 NoneBot 以及 全局 {ref}`nonebot.drivers.Driver` 对象。
NoneBot 将会从 .env 文件中读取环境信息,并使用相应的 env 文件配置。
Expand Down
Loading

0 comments on commit 1153c5f

Please sign in to comment.