添加 MySQL连接是否enbale的配置处理
This commit is contained in:
@@ -5,6 +5,7 @@ const config = {
|
||||
methods: ['GET', 'POST']
|
||||
},
|
||||
mysql: {
|
||||
enable: false,
|
||||
host: 'localhost',
|
||||
port: 3306,
|
||||
database: '',
|
||||
|
||||
@@ -12,6 +12,10 @@ class MySQLConnectPool {
|
||||
private logger = new Logger('MySQLConnection');
|
||||
|
||||
constructor() {
|
||||
if(!config.mysql.enable){
|
||||
this.logger.warn('Database is disabled, initialization terminated');
|
||||
return;
|
||||
}
|
||||
this.pool = this.createConnectPool();
|
||||
this.logger.info("Database connection pool created")
|
||||
setTimeout(async () => {
|
||||
|
||||
Reference in New Issue
Block a user