29 lines
573 B
Python
29 lines
573 B
Python
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"
|
|
] |