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