diff --git a/README.md b/README.md index a037790..c60bcea 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ The following environment variables are supported: | `REDIS_HOST` | x | `null` | Redis host (**IMPORTANT** must be same redis instance that stores bull jobs!) | | `REDIS_PORT` | x | `null` | Redis port | | `REDIS_PASSWORD` | | `null` | Redis password | +| `REDIS_DB` | | `0` | Redis database index to use (see `options.db` from [docs](https://ioredis.readthedocs.io/en/latest/API/#new-redisport-host-options)) | | `UI` | | `bull-board` | UI to use (supported: `arena`, `bull-board`) | | `BULL_WATCH_QUEUE_PREFIXES` | | `bull` | Bull prefixes to monitor (globs like `prefix*` are supported) | | `BULL_COLLECT_QUEUE_METRICS_INTERVAL_MS` | | `60000` | How often queue metrics are gathered | diff --git a/src/bull/bull.module.ts b/src/bull/bull.module.ts index 7950310..b0f60c3 100644 --- a/src/bull/bull.module.ts +++ b/src/bull/bull.module.ts @@ -23,6 +23,7 @@ import { BullMQMetricsFactory } from './bullmq-metrics.factory'; host: configService.config.REDIS_HOST, password: configService.config.REDIS_PASSWORD, port: configService.config.REDIS_PORT, + db: configService.config.REDIS_DB, enableReadyCheck: true, reconnectOnError: () => true, }; diff --git a/src/config/config.service.ts b/src/config/config.service.ts index 8a5ef19..579073a 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -23,6 +23,10 @@ export class ConfigService { * to manually set keyspace notifications) */ REDIS_CONFIGURE_KEYSPACE_NOTIFICATIONS: bool({ default: true }), + /** + * Redis database number + */ + REDIS_DB: num({ default: 0 }), /** * Redis host to fetch queues from */