modify: auth 插件

This commit is contained in:
2026-07-23 17:45:44 +08:00
parent 95ef842d92
commit 2b7b8ee08c
21 changed files with 753 additions and 43 deletions
+29
View File
@@ -0,0 +1,29 @@
from typing import Any
from chongming_config import get_config
from chongming_jwt import JWT
from chongming_database import Database
from .models import *
def set_global_var(name: str, value: Any) -> None:
"""
设置当前模块的全局变量。
Args:
name: 变量名(字符串)
value: 任意值
"""
globals()[name] = value
config = get_config()
db: Database | None = None
secret = config["security"]["secret_key"]
algorithm = config["security"]["algorithm"]
jwt = JWT(secret, algorithm)
__all__ = [
"db",
"jwt"
]