Support downloading configuration files from external URLs.
Browse files
utils.py
CHANGED
@@ -25,8 +25,10 @@ def update_config(config_data):
|
|
25 |
def load_config():
|
26 |
try:
|
27 |
with open('./api.yaml', 'r') as f:
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
except FileNotFoundError:
|
31 |
logger.error("配置文件 'api.yaml' 未找到。请确保文件存在于正确的位置。")
|
32 |
return [], [], []
|
|
|
25 |
def load_config():
|
26 |
try:
|
27 |
with open('./api.yaml', 'r') as f:
|
28 |
+
# 判断是否为空文件
|
29 |
+
if f.readable():
|
30 |
+
conf = yaml.safe_load(f)
|
31 |
+
return update_config(conf)
|
32 |
except FileNotFoundError:
|
33 |
logger.error("配置文件 'api.yaml' 未找到。请确保文件存在于正确的位置。")
|
34 |
return [], [], []
|