初始化
This commit is contained in:
17
ds/config.py
Normal file
17
ds/config.py
Normal file
@ -0,0 +1,17 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
# 读取配置文件路径
|
||||
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../config.ini")
|
||||
|
||||
# 初始化配置解析器
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
# 读取配置文件
|
||||
config.read(config_path, encoding="utf-8")
|
||||
|
||||
# 暴露配置项(方便其他文件调用)
|
||||
SERVER_CONFIG = config["server"]
|
||||
MYSQL_CONFIG = config["mysql"]
|
||||
JWT_CONFIG = config["jwt"]
|
||||
LIVE_CONFIG = config["live"]
|
Reference in New Issue
Block a user