-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
33 lines (21 loc) · 915 Bytes
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from apps.schemas import APIConfig
import os
import yaml
from mark import BASE_DIR
from core.mysql.schemas import MysqlConfig
from core.milvus.schemas import MilvusConfig
from core.minio.schemas import MinioConfig
from loguru import logger
run_mode = os.environ.get('RUN_MODE', 'local').lower()
logger.debug(f'当前的运行模式: {run_mode}')
with open(BASE_DIR/'config.yaml', 'r', encoding='utf-8') as f:
config: dict[str, dict] = yaml.load(f.read(), Loader=yaml.CLoader)
current_config: dict[str, dict] = config[run_mode]
MYSQL_CONFIG = MysqlConfig(
**(current_config.get('mysql', {}))
)
MILVUS_CONFIG = MilvusConfig(**(current_config['milvus']))
MINIO_CONFIG = MinioConfig(**(current_config['minio']))
minio_public_base_url = f'http://{MINIO_CONFIG.end_point}/{MINIO_CONFIG.bucket}'
minio_relative_base_url = f'/{MINIO_CONFIG.bucket}'
API_CONFIG = APIConfig(**(current_config['api']))