18 lines
		
	
	
		
			453 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			18 lines
		
	
	
		
			453 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | 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"] | ||
|  | BUSINESS_CONFIG = config["business"] |