docs: 更新项目文档,完善需求和技术细节
This commit is contained in:
47
backend/config/database.js
Normal file
47
backend/config/database.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 数据库配置文件
|
||||
* 包含测试环境和生产环境的MySQL连接配置
|
||||
*/
|
||||
|
||||
const databaseConfig = {
|
||||
// 测试环境配置
|
||||
development: {
|
||||
host: '192.168.0.240',
|
||||
port: 3306,
|
||||
username: 'root',
|
||||
password: 'aiot$Aiot123',
|
||||
database: 'ajhdata',
|
||||
dialect: 'mysql',
|
||||
logging: console.log,
|
||||
pool: {
|
||||
max: 20,
|
||||
min: 5,
|
||||
acquire: 30000,
|
||||
idle: 10000
|
||||
}
|
||||
},
|
||||
|
||||
// 生产环境配置
|
||||
production: {
|
||||
host: '129.211.213.226',
|
||||
port: 9527,
|
||||
username: 'root',
|
||||
password: 'aiotAiot123!',
|
||||
database: 'ajhdata',
|
||||
dialect: 'mysql',
|
||||
logging: false, // 生产环境关闭SQL日志
|
||||
pool: {
|
||||
max: 200,
|
||||
min: 20,
|
||||
acquire: 30000,
|
||||
idle: 30000
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 根据环境变量选择配置
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
module.exports = databaseConfig[env];
|
||||
|
||||
// 导出完整配置对象(用于其他需要访问所有配置的场景)
|
||||
module.exports.allConfigs = databaseConfig;
|
||||
Reference in New Issue
Block a user