47 lines
1004 B
JavaScript
47 lines
1004 B
JavaScript
/**
|
|
* 数据库配置文件
|
|
* 包含测试环境和生产环境的MySQL连接配置
|
|
*/
|
|
|
|
const databaseConfig = {
|
|
// 开发环境配置
|
|
development: {
|
|
host: '129.211.213.226',
|
|
port: 9527,
|
|
username: 'root',
|
|
password: 'aiotAiot123!',
|
|
database: 'xlxumudata',
|
|
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: 'xlxumudata',
|
|
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; |