2025-02-14 00:54:59 +08:00
|
|
|
import os
|
2025-02-02 23:01:14 +08:00
|
|
|
import argparse
|
2025-02-14 00:54:59 +08:00
|
|
|
from core.utils.util import read_config, get_project_dir
|
2025-02-02 23:01:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_config():
|
|
|
|
|
"""加载配置文件"""
|
|
|
|
|
parser = argparse.ArgumentParser(description="Server configuration")
|
2025-02-14 00:54:59 +08:00
|
|
|
default_config_file = "config.yaml"
|
|
|
|
|
# 判断是否存在私有的配置文件
|
|
|
|
|
if os.path.exists(get_project_dir() + "." + default_config_file):
|
|
|
|
|
default_config_file = "." + default_config_file
|
|
|
|
|
parser.add_argument("--config_path", type=str, default=default_config_file)
|
2025-02-02 23:01:14 +08:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
return read_config(args.config_path)
|