Open bivanychko-intobi opened 4 years ago
did you manage to fix this?
You are correct : the 'database' property is what you are looking. Check below my redis.datasource.ts
@lifeCycleObserver('datasource') export class RedisDataSource extends juggler.DataSource implements LifeCycleObserver { static dataSourceName = 'redis';
constructor( @inject('datasources.config.redis', { optional: true }) dsConfig: object = { ...config }, ) { // Override data source config from environment variables Object.assign(dsConfig, { host: process.env.REDIS_HOST, port: process.env.REDIS_PORT, password: process.env.REDIS_PASSWORD, db: process.env.REDIS_DATABASE, url: process.env.REDIS_URL, }); super(dsConfig); }
Out of the box, a Redis instance supports 16 logical databases. These databases are effectively siloed off from one another, and when you run a command in one database it doesn’t affect any of the data stored in other databases in your Redis instance. Redis databases are numbered from 0 to 15 and, by default, you connect to database 0 when you connect to your Redis instance. However, you can change the database you’re using with the select command after you connect: 127.0.0.1:6379 > select 15 127.0.0.1:6379[15] > ...
So my question is next: how can I set this db number for my redis instance in loopback? I saw that in redis connector config there is property called 'database' but I am not sure if it's the property I am looking for