Files
QingLong/AI/SyncData/config/db_config.py

51 lines
1.2 KiB
Python
Raw Normal View History

2025-08-15 09:13:13 +08:00
import os
# 数据库配置
ENV = os.getenv('ENV', 'dev') # 默认环境为dev
if ENV == 'prod':
MYSQL_CONFIG = {
'host': '10.10.14.101',
'port': 3306,
'user': 'ylt',
'password': 'Ycharge666',
'database': 'yltcharge',
'charset': 'utf8mb4'
}
CH_CONFIG = {
'host': '10.10.14.250',
'port': 9000,
'settings': {
'max_insert_block_size': 100000,
'async_insert': 1,
'wait_for_async_insert': 0
}
}
else:
MYSQL_CONFIG = {
'host': '10.10.14.101',
'port': 3306,
'user': 'ylt',
'password': 'Ycharge666',
'database': 'yltcharge',
'charset': 'utf8mb4'
}
CH_CONFIG = {
'host': '10.10.14.250',
'port': 9000,
'user': 'default',
'password': 'DsideaL147258369',
'database': 'default',
'settings': {
'max_insert_block_size': 100000,
'async_insert': 1,
'wait_for_async_insert': 0
}
}
def print_config():
print("当前配置:")
print(f"环境: {os.getenv('ENV', 'dev')}")