add
This commit is contained in:
25
config/database.py
Normal file
25
config/database.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# MySQL数据库配置
|
||||
DATABASE_CONFIG = {
|
||||
'host': os.getenv('DB_HOST', 'localhost'),
|
||||
'port': int(os.getenv('DB_PORT', 3306)),
|
||||
'user': os.getenv('DB_USER', 'root'),
|
||||
'password': os.getenv('DB_PASSWORD', ''),
|
||||
'database': os.getenv('DB_DATABASE', 'exchange_monitor'),
|
||||
'charset': 'utf8mb4',
|
||||
'pool_size': int(os.getenv('DB_POOL_SIZE', 10)),
|
||||
'max_overflow': int(os.getenv('DB_MAX_OVERFLOW', 20)),
|
||||
'pool_recycle': int(os.getenv('DB_POOL_RECYCLE', 3600))
|
||||
}
|
||||
|
||||
# SQLAlchemy配置
|
||||
SQLALCHEMY_CONFIG = {
|
||||
'echo': os.getenv('SQLALCHEMY_ECHO', 'False').lower() == 'true',
|
||||
'echo_pool': os.getenv('SQLALCHEMY_ECHO_POOL', 'False').lower() == 'true',
|
||||
'pool_pre_ping': True,
|
||||
'pool_recycle': 3600
|
||||
}
|
||||
Reference in New Issue
Block a user