modify: auth 插件
This commit is contained in:
@@ -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"
|
||||
]
|
||||
Reference in New Issue
Block a user