28 lines
631 B
Python
28 lines
631 B
Python
from typing import Any
|
||||
|
|
|
|||
|
|
from chongming_config import get_config
|
|||
|
|
from chongming_database import Database
|
|||
|
|
from chongming_cache import Cache
|
|||
|
|
|
|||
|
|
def set_global_var(name: str, value: Any) -> None:
|
|||
|
|
"""
|
|||
|
|
设置当前模块的全局变量。
|
|||
|
|
|
|||
|
|
Args:
|
|||
|
|
name: 变量名(字符串)
|
|||
|
|
value: 任意值
|
|||
|
|
"""
|
|||
|
|
globals()[name] = value
|
|||
|
|
|
|||
|
|
config = get_config()
|
|||
|
|
|
|||
|
|
db: Database | None = None
|
|||
|
|
cache: Cache | None = None # chongming_cache.Cache(OAuth state / OTP 验证码)
|
|||
|
|
plugin_config: dict = {} # [workers.config] 运行时配置(github 凭据等)
|
|||
|
|
|
|||
|
|
__all__ = [
|
|||
|
|
"db",
|
|||
|
|
"cache",
|
|||
|
|
"plugin_config",
|
|||
|
|
]
|