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

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