添加 Redis是否enabled的配置处理
This commit is contained in:
@@ -12,6 +12,7 @@ const config = {
|
||||
password: ''
|
||||
},
|
||||
redis: {
|
||||
enable: false,
|
||||
host: 'localhost',
|
||||
port: 6379,
|
||||
password: '' // localhost
|
||||
|
||||
@@ -7,6 +7,11 @@ class _RedisConnection {
|
||||
private logger = new Logger('Redis')
|
||||
|
||||
constructor() {
|
||||
if (!config.redis.enable) {
|
||||
this.logger.info('Database is disabled, initialization terminated');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.pool = new Redis({
|
||||
port: config.redis.port,
|
||||
|
||||
Reference in New Issue
Block a user