File size: 548 Bytes
f8bd4d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import yaml
from loguru import logger

class Config:
    def __init__(self, config_path):
        """
        初始化 Config 类,读取指定路径的 YAML 配置文件。
        :param config_path: 配置文件的路径
        """
        with open(config_path, 'r') as file:
            self.config = yaml.safe_load(file)
        logger.info(f"加载配置文件{self.config}")

    def get_config(self):
        """
        获取读取的配置信息。
        :return: 包含配置信息的字典
        """
        return self.config