Имя коллекции получается из конфига

This commit is contained in:
Pavel Gnedov 2022-07-24 06:45:15 +07:00
parent de05a86f59
commit 5d4fd808f3

View file

@ -1,6 +1,9 @@
import { CouchDb } from '@app/event-emitter/couchdb-datasources/couchdb'; import { CouchDb } from '@app/event-emitter/couchdb-datasources/couchdb';
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import nano from 'nano'; import nano from 'nano';
import configuration from '../configs/app';
const config = configuration();
@Injectable() @Injectable()
export class Changes { export class Changes {
@ -16,7 +19,7 @@ export class Changes {
} }
Changes.initilized = true; Changes.initilized = true;
const n = CouchDb.getCouchDb(); const n = CouchDb.getCouchDb();
const changesDbName = ''; // TODO: Загрузить из конфига const changesDbName = config.couchDb.dbs.changes;
const dbs = await n.db.list(); const dbs = await n.db.list();
if (!dbs.includes(changesDbName)) { if (!dbs.includes(changesDbName)) {
await n.db.create(changesDbName); await n.db.create(changesDbName);